rhevm-qe-automation / pytest_jira

py.test plugin to integrate with JIRA
GNU General Public License v2.0
29 stars 25 forks source link

Added keyword option "skipif" to disable issue marker #89

Closed mjuuti-tns closed 6 years ago

mjuuti-tns commented 6 years ago

Add optional keyword argument 'condition' to jira markers to be able to disable marker if conditions are not met for example if Jira issue is specific only for one environment but does not affect others.

liiight commented 6 years ago

I like this idea, but I would call the keyword skipif to match pytest's terminology.

mjuuti-tns commented 6 years ago

Sure, I'll do changes tomorrow (it's midnight here). Just one verification: skipif=True-like object (or Callable which returns True-like object) would

I'd believe latter but just in case :)

liiight commented 6 years ago

That's a great question... I'm actually leaning towards the former, as in apply the marker if the condition is true.

lukas-bednar commented 6 years ago

I was consider following workflow: lets say that in case skipif is passed to marker, then it expects to get function which takes issue argument as a parameter. in this case plugin calls passed function with appropriate issue as an argument, and depends on result the test-cases will be skipped (returned true) or executed (returned fasle).

Does it make sense, fit to your use-case ?

codecov-io commented 6 years ago

Codecov Report

Merging #89 into master will increase coverage by 0.09%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #89      +/-   ##
==========================================
+ Coverage   97.82%   97.91%   +0.09%     
==========================================
  Files           1        1              
  Lines         184      192       +8     
==========================================
+ Hits          180      188       +8     
  Misses          4        4
Impacted Files Coverage Δ
pytest_jira.py 97.91% <100%> (+0.09%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d60d3e9...80d435c. Read the comment docs.

mjuuti-tns commented 6 years ago

Sure; my current use case only needs boolean, e.g. jira("ABC-1234", skipif=(Config.Value==Constant.Value)); Information which is available for python process but most likely is not in JIRA.

I added lambda handling but it came with some drawbacks:

lukas-bednar commented 6 years ago

I am giving some time to @liiight if he wants to share his opinion here, since he has expressed interest in this feature :-)

liiight commented 6 years ago

Looks great to me, thanks for considering me

lukas-bednar commented 6 years ago

@mjuuti-tns Thank you.