diff --git a/tests/conftest.py b/tests/conftest.py index 98dcb3be960b1..9fdda1467cf73 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -909,8 +909,16 @@ def clear_lru_cache(): @pytest.fixture(autouse=True) def refuse_to_run_test_from_wrongly_named_files(request): + dirname: str = request.node.fspath.dirname filename: str = request.node.fspath.basename - if not request.node.fspath.basename.startswith("test_"): + is_system_test: bool = "tests/system/" in dirname + if is_system_test and not request.node.fspath.basename.startswith("example_"): + raise Exception( + f"All test method files in tests/system must start with 'example_'. Seems that {filename} " + f"contains {request.function} that looks like a test case. Please rename the file to " + f"follow the example_* pattern if you want to run the tests in it." + ) + if not is_system_test and not request.node.fspath.basename.startswith("test_"): raise Exception( f"All test method files in tests/ must start with 'test_'. Seems that {filename} " f"contains {request.function} that looks like a test case. Please rename the file to "