[TIP] pytest skipif marker with fixtures
Christian Staffa
Christian.Staffa at gmx.de
Thu Dec 12 10:37:24 PST 2013
Hi all on the list :)
Well, I am writing here a test with the pytest framework.
I got started to write me a own plugin for my testing environment.
This plugin generates a fixture on session level.
Now I write a test and define a testfunctiont which uses my fixture being instanciated by the plugin....
But I want to use a skipif marker when a certain condition is given produced by the plugin fixture.
How can i achieve that? Any ideas? is it possible?
Enough story... here is an example in essence:)
# file: testfile.py
# product is the fixture instanciated by the plugin
import pytest
class TestMyProduct:
pytest.skipif(product.name != 'blabla')
def test_product_name(self, product):
print product.name
assert name == 'blabla'
Thanks for any comments :)
Chris
More information about the testing-in-python
mailing list