Selecting Tests with -m

pytest
Author

Imad Dabbura

Published

March 25, 2023

We can use the the flag -m marker_name to run tests that matched the provided marker name(s). We can also use (), and, or, and not to select tests based on markers. However, the name of the markers must be in full and we can’t use substrings or part of the marker. This is different from the -k flag, which lets us use substrings or part of the test name to run those test.