Aller au contenu

Test naming convention (ARCH2008)

Ce contenu n’est pas encore disponible dans votre langue.

Key python.naming.test-name-convention · Severity info · Category naming

Test functions must follow the framework’s discovery convention (the test_ prefix in pytest). Tests that do not are never collected and run silently nowhere.

def check_addition(): # not prefixed 'test_', pytest won't collect it
assert add(2, 3) == 5
def test_addition_returns_sum():
assert add(2, 3) == 5

Name test functions per the framework convention (pytest: test_ prefix plus a descriptive name).