jeudi 31 janvier 2019

Perform sanity check before running tests with pytest

I would like to perform some sanity check when I run tests using pytest. Typically, I want to check that some executables are accessible to the tests, and that the options provided by the user on the command-line are valid.

The closest thing I found was to use a fixture such as:

@pytest.fixture(scope="session", autouse=True)
def sanity_check(request):
  if not good:
     sys.exit(0)


But this still runs all the tests. I'd like for the script to fail before attempting to run the tests.

Aucun commentaire:

Enregistrer un commentaire