rhevm-qe-automation/pytest_jira

Add a fixture so you can skip programmatically

Closed this issue · 5 comments

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.

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 ?

@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.

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.