August 2018
Beginner
160 pages
4h 8m
English
You can run tests by using marks as selection factors with the -m flag. For example, to run all tests with the slow mark:
λ pytest -m slow
The -m flag also accepts expressions, so you can do a more advanced selection. To run all tests with the slow mark but not the tests with the serial mark you can use::
λ pytest -m "slow and not serial"
The expression is limited to the and, not, and or operators.
Custom marks can be useful for optimizing test runs on your CI system. Oftentimes, environment problems, missing dependencies, or even some code committed by mistake might cause the entire test suite to fail. By using marks, you can choose a few tests that are fast and/or broad enough to detect problems in a good portion ...
Read now
Unlock full access