rhevm-qe-automation / pytest_jira

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

Add a fixture so you can skip programmatically #75

Closed liiight closed 7 years ago

liiight commented 7 years ago

There are certain situation that I would rather to just skip via an internal if condition and not necessary skip the entire test. I could use a jira fixture that would enable me to do that. @lukas-bednar i'm pretty busy but i'll make an effort to support this myself and push a PR.

liiight commented 7 years ago

I actually started looking into this and got stumped pretty early on 😄 I'm not sure where to add the fixture, as it need to plugin to already be loaded and also use the same credentials and other set options for it. I thought of saving some of the data in global variable but that seems hacky and disgusting to me. Any tips to get me started @lukas-bednar ?

lukas-bednar commented 7 years ago

@liiight for example you can get inspiration what they do in junitxml plugin.

in pytest_configure they store Instance of plugin in pytest.config

https://github.com/pytest-dev/pytest/blob/master/_pytest/junitxml.py#L236

and then they use this instance inside of fixture

https://github.com/pytest-dev/pytest/blob/master/_pytest/junitxml.py#L202

I think you can do same for this plugin as well.

liiight commented 7 years ago

gotcha, exactly what i was looking for! I'm not as familiar with pytest plugin development, didn't even occur to me that request will hold the config object.

liiight commented 7 years ago

77

lukas-bednar commented 7 years ago

via #77