I have a py.test
function like the follows:
def my_test(self, driver):
# Do something with the driver
which uses a driver
fixture (defined in conftest.py
).
Now, I need to check something before running this test. If that check fails, I need to skip this test. Here is what I tried:
@pytest.mark.skipif(not driver.check(),
reason="Some check negative.")
def my_test(self, driver):
# Do something with the driver
But that marker uses a fixture itself (it might be the same fixture, or a different fixture, it does not matter here). Is there a simple way I can use a fixture in a skipif
marker?