Skip to content

Commit 08b3fe0

Browse files
committed
Fix testing tests command to allow passing test as extra arg
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 #42632
1 parent 51f9e83 commit 08b3fe0

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4e128855ff2df624e0fc59e229b0973d
1+
69c5e660ec3f263dad58cc7a7710d4ed

dev/breeze/src/airflow_breeze/commands/testing_commands.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def _verify_parallelism_parameters(
553553
@option_use_packages_from_dist
554554
@option_use_xdist
555555
@option_verbose
556-
@click.argument("extra_pytest_args", nargs=-1, type=click.UNPROCESSED)
556+
@click.argument("extra_pytest_args", nargs=-1, type=click.Path(path_type=str))
557557
def command_for_tests(**kwargs):
558558
_run_test_command(**kwargs)
559559

@@ -877,8 +877,16 @@ def _run_test_command(
877877
)
878878
else:
879879
if shell_params.test_type == "Default":
880-
if any([arg.startswith("tests") for arg in extra_pytest_args]):
880+
if any(
881+
[
882+
arg.startswith("tests/")
883+
or arg.startswith("providers/tests/")
884+
or arg.startswith("task_sdk/tests/")
885+
for arg in extra_pytest_args
886+
]
887+
):
881888
# in case some tests are specified as parameters, do not pass "tests" as default
889+
# test_type = "All" as default and it will run all "tests" by default then
882890
shell_params.test_type = "None"
883891
shell_params.parallel_test_types_list = []
884892
else:

dev/breeze/src/airflow_breeze/utils/run_tests.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ def find_all_other_tests() -> list[str]:
212212
PROVIDERS_LIST_EXCLUDE_PREFIX = "Providers[-"
213213

214214
ALL_TEST_SUITES: dict[str, tuple[str, ...]] = {
215+
# TODO: This is not really correct now - we should allow to run both providers and airflow
216+
# as "ALL" tests - currently it is not possible due to conftest.py present at top-level of
217+
# all different test suites ("tests", "providers/tests", "task_sdk/tests")
218+
# The only reason it is working now in CI is because we run tests in parallel (both DB and non-DB)
219+
# each test subfolder is separately specified in the pytest command line
220+
# This should be solved as part of https://github.com/apache/airflow/issues/42632
215221
"All": ("tests",),
216222
"All-Long": ("tests", "-m", "long_running", "--include-long-running"),
217223
"All-Quarantined": ("tests", "-m", "quarantined", "--include-quarantined"),

0 commit comments

Comments
 (0)