This is an automated email from the ASF dual-hosted git repository.

ferruzzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 6064a6e3e7 Fix refuse_to_run_test_from_wrongly_named_files to handle 
system tests (#32655)
6064a6e3e7 is described below

commit 6064a6e3e78605d1fe79e2acfa473e860312d685
Author: Vincent <97131062+vincb...@users.noreply.github.com>
AuthorDate: Mon Jul 17 14:55:23 2023 -0400

    Fix refuse_to_run_test_from_wrongly_named_files to handle system tests 
(#32655)
---
 tests/conftest.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/conftest.py b/tests/conftest.py
index 98dcb3be96..9fdda1467c 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 "

Reply via email to