Pytest Commands¶
Source: Very Academy
This guide outlines various commands to run tests using pytest.
- Run pytest:
-
Run pytest specify markers:
-
Run all tests in a directory:
-
Run tests in a specific file:
-
Run a specific test function:
-
Run tests that match a specific substring:
-
Run tests based on markers:
-
Run tests and generate code coverage report:
-
Run tests and display print statements:
-
Run tests and stop at the first failure:
-
Run tests in parallel:
-
Run tests with verbose output:
-
Run tests and ignore warnings:
-
Run tests and rerun failed tests:
-
Run tests and mark them as slow:
-
Run tests and mark them as xfail (expected to fail):