LinuxCommandLibrary

pytest

Run Python tests.

TLDR

Run tests from specific files

$ pytest [path/to/test_file1.py path/to/test_file2.py ...]
copy


Run tests with names matching a specific [k]eyword expression
$ pytest -k [expression]
copy


Exit as soon as a test fails or encounters an error
$ pytest --exitfirst
copy


Run tests matching or excluding markers
$ pytest -m [marker_name1 and not marker_name2]
copy


Run until a test failure, continuing from the last failing test
$ pytest --stepwise
copy


Run tests without capturing output
$ pytest --capture=no
copy

Copied to clipboard