With pytest, one can mark tests using a decorator
@pytest.mark.slow
def some_slow_test():
pass
Then, from the command line, one can tell py
If you are trying to run the tests from inside a python file, that is, you run your tests by calling
$ python testfile.py
which has contents
import pytest
pytest.main()
and you want to know how to pass the CLI flag in to pytest.main
, the answer is:
pytest.main(["-m", "not slow"])
PS - yes, there are legitimate reasons to call tests this way. Pray you never have to learn them.