Pytest: Shows only Failed Tests

When testing your function using Pytest, you might want to print only failed tests instead of both failed and successful tests. If so, add --lf to pytest. “lf” stands for “list fails”.

If you are not aware of Pytest, it is the framework that makes it easy to write small tests in Python. You can find more about Pytest from my previous article.

Scroll to Top