serhii.net

In the middle of the desert you can say anything you want

21 Feb 2023

pytest skipif

From How to use skip and xfail to deal with tests that cannot succeed — pytest documentation on dynamically skipping tests based on a condition:

@pytest.mark.skipif(sys.version_info < (3, 10), reason="requires python3.10 or higher")
def test_function():

Better than my previous approach of if xxx: pytest.skip("...") inside the tests themselves.

Nel mezzo del deserto posso dire tutto quello che voglio.