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: Force default order

If for some reason we would like to make sure the order remains the same, in a given module, we can add the following two lines of code.

import pytest
pytestmark = pytest.mark.random_order(disabled=True)
import pytest
pytestmark = pytest.mark.random_order(disabled=True)

def test_one():
    assert True

def test_two():
    assert True

def test_three():
    assert True