pytest Cheat Sheet
This article was first published on Python - datawookie , and kindly contributed to python-bloggers. (You can report issue about the content on this page here)
Want to share your content on python-bloggers? click here.
Want to share your content on python-bloggers? click here.
Notes to self on using pytest
.
Options
-s
— Show content printed tostdout
--log-cli-level
— Show logging output for specified level--disable-warnings
— Suppress warning messages-v
— Verbose output-x
— Stop after the first failure--maxfail
— Stop after specific number of failures--lf
/--last-failed
— Only rerun the tests that failed previously--ff
/--failed-first
— Run failed tests first--durations
— Show specified number of slowest tests
Run Specific Tests
pytest test_file.py pytest test_file.py::test_function
To leave a comment for the author, please follow the link and comment on their blog: Python - datawookie .
Want to share your content on python-bloggers? click here.