← How-To Guides How-To How to run tests with pytest Install pytest, name files test_*.py, define def test_*(). Run pytest. pytest Discovers and runs tests. # test_foo.py def test_add(): assert 1 + 1 == 2