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

potiuk 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 b3e902dd249 Fix testing tests command to allow passing test as extra 
arg (#43529)
b3e902dd249 is described below

commit b3e902dd2490a6d68a24846244106460aea8e299
Author: Jarek Potiuk <[email protected]>
AuthorDate: Thu Oct 31 10:17:06 2024 +0100

    Fix testing tests command to allow passing test as extra arg (#43529)
    
    When providers have been moved in #42505 broke passing parameters
    when provider tests were passed as extra args of "testing tests"
    command of breeze.
    
    Previously all tests were under "tests" folder and there was
    an exclusion to disable "All" tests when any test was passed as
    parameter. But after moving tests to "providers" this stopped working.
    
    Additional exclusion needs to be added for "providers/tests" and
    "providers/tests_sdk/".
    
    This PR also adds autocompletion for tests passed this way by
    setting the click type to Path for the extra args (but without
    the need for the Path to exist).
    
    Also during this check it turned out that "All" tests are not
    working in the intended way - but this should not impact our CI
    only local runs.
    
    Appropriate comment has been added and it's captured in
    https://github.com/apache/airflow/issues/42632
---
 dev/breeze/doc/images/output_testing_tests.txt             |  2 +-
 dev/breeze/src/airflow_breeze/commands/testing_commands.py | 12 ++++++++++--
 dev/breeze/src/airflow_breeze/utils/run_tests.py           |  6 ++++++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/dev/breeze/doc/images/output_testing_tests.txt 
b/dev/breeze/doc/images/output_testing_tests.txt
index bc12c1fb42a..67808ed7f40 100644
--- a/dev/breeze/doc/images/output_testing_tests.txt
+++ b/dev/breeze/doc/images/output_testing_tests.txt
@@ -1 +1 @@
-4e128855ff2df624e0fc59e229b0973d
+69c5e660ec3f263dad58cc7a7710d4ed
diff --git a/dev/breeze/src/airflow_breeze/commands/testing_commands.py 
b/dev/breeze/src/airflow_breeze/commands/testing_commands.py
index 3c3015cd7fe..2d76b66f374 100644
--- a/dev/breeze/src/airflow_breeze/commands/testing_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/testing_commands.py
@@ -553,7 +553,7 @@ option_force_sa_warnings = click.option(
 @option_use_packages_from_dist
 @option_use_xdist
 @option_verbose
[email protected]("extra_pytest_args", nargs=-1, type=click.UNPROCESSED)
[email protected]("extra_pytest_args", nargs=-1, type=click.Path(path_type=str))
 def command_for_tests(**kwargs):
     _run_test_command(**kwargs)
 
@@ -877,8 +877,16 @@ def _run_test_command(
         )
     else:
         if shell_params.test_type == "Default":
-            if any([arg.startswith("tests") for arg in extra_pytest_args]):
+            if any(
+                [
+                    arg.startswith("tests/")
+                    or arg.startswith("providers/tests/")
+                    or arg.startswith("task_sdk/tests/")
+                    for arg in extra_pytest_args
+                ]
+            ):
                 # in case some tests are specified as parameters, do not pass 
"tests" as default
+                # test_type = "All" as default and it will run all "tests" by 
default then
                 shell_params.test_type = "None"
                 shell_params.parallel_test_types_list = []
             else:
diff --git a/dev/breeze/src/airflow_breeze/utils/run_tests.py 
b/dev/breeze/src/airflow_breeze/utils/run_tests.py
index 99763c1196b..81cd0671dd8 100644
--- a/dev/breeze/src/airflow_breeze/utils/run_tests.py
+++ b/dev/breeze/src/airflow_breeze/utils/run_tests.py
@@ -212,6 +212,12 @@ PROVIDERS_LIST_PREFIX = "Providers["
 PROVIDERS_LIST_EXCLUDE_PREFIX = "Providers[-"
 
 ALL_TEST_SUITES: dict[str, tuple[str, ...]] = {
+    # TODO: This is not really correct now - we should allow to run both 
providers and airflow
+    # as "ALL" tests - currently it is not possible due to conftest.py present 
at top-level of
+    # all different test suites ("tests", "providers/tests", "task_sdk/tests")
+    # The only reason it is working now in CI is because we run tests in 
parallel (both DB and non-DB)
+    # each test subfolder is separately specified in the pytest command line
+    # This should be solved as part of 
https://github.com/apache/airflow/issues/42632
     "All": ("tests",),
     "All-Long": ("tests", "-m", "long_running", "--include-long-running"),
     "All-Quarantined": ("tests", "-m", "quarantined", "--include-quarantined"),

Reply via email to