Python pytest

From John Freier
Revision as of 14:43, 28 May 2024 by Jfreier (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

To run tests in a specific dir

 pytest path/to/dir

To run tests in a specific file

 pytest path/to/test_file.py

To run a specific test in a file

 pytest path/to/test_file.py::test_function

or

 pytest path/to/test_file.py -k 'test_name'

To show the print statements.

 -s or --capture=no

To show log statements

 -o log_cli=true

To set the log level.

 --log-cli-level=INFO