Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PyTest: Order of tests

Pytest runs the test in the same order as they are found in the test module:

def test_one():
    assert True

def test_two():
    assert True

def test_three():
    assert True

pytest -v

test_order.py::test_one PASSED
test_order.py::test_two PASSED
test_order.py::test_three PASSED