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 f099bea9fa Fix failure of selective checks when only API has been modified (#40904) f099bea9fa is described below commit f099bea9faf5472b170834767ff4f733af5c960e Author: Jarek Potiuk <ja...@potiuk.com> AuthorDate: Sat Jul 20 16:50:04 2024 +0200 Fix failure of selective checks when only API has been modified (#40904) We were removing "Providers" from the list of candidates and handled the key non-existing but there were a path when splitting to individual provider tests for "compatibility checks" was failing. This is split from #40881 and test is added. Co-authored-by: Omkar P <45419097+omkar-f...@users.noreply.github.com> --- .../src/airflow_breeze/utils/selective_checks.py | 11 ++--- dev/breeze/tests/test_selective_checks.py | 50 ++++++++++++++++++++++ 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py b/dev/breeze/src/airflow_breeze/utils/selective_checks.py index d31c6005d7..f5ec84bea7 100644 --- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py +++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py @@ -761,19 +761,14 @@ class SelectiveChecks: include_docs=False, ) if affected_providers != "ALL_PROVIDERS" and affected_providers is not None: - try: - candidate_test_types.remove("Providers") - except KeyError: - # In case of API tests Providers could not be in the list originally so we can ignore - # Providers missing in the list. - pass + candidate_test_types.discard("Providers") if split_to_individual_providers: for provider in affected_providers: candidate_test_types.add(f"Providers[{provider}]") else: candidate_test_types.add(f"Providers[{','.join(sorted(affected_providers))}]") - elif split_to_individual_providers: - candidate_test_types.remove("Providers") + elif split_to_individual_providers and "Providers" in candidate_test_types: + candidate_test_types.discard("Providers") for provider in get_available_packages(): candidate_test_types.add(f"Providers[{provider}]") get_console().print( diff --git a/dev/breeze/tests/test_selective_checks.py b/dev/breeze/tests/test_selective_checks.py index 513edeff5f..dc60de533a 100644 --- a/dev/breeze/tests/test_selective_checks.py +++ b/dev/breeze/tests/test_selective_checks.py @@ -157,6 +157,56 @@ def assert_outputs_are_printed(expected_outputs: dict[str, str], stderr: str): id="Only API tests and DOCS and FAB provider should run", ) ), + ( + pytest.param( + ("airflow/api_internal/file.py",), + { + "all-python-versions": "['3.8']", + "all-python-versions-list-as-string": "3.8", + "python-versions": "['3.8']", + "python-versions-list-as-string": "3.8", + "ci-image-build": "true", + "prod-image-build": "false", + "needs-helm-tests": "false", + "run-tests": "true", + "run-amazon-tests": "false", + "docs-build": "true", + "skip-pre-commits": "check-provider-yaml-valid,identity,lint-helm-chart,mypy-airflow,mypy-dev," + "mypy-docs,mypy-providers,ts-compile-format-lint-www", + "upgrade-to-newer-dependencies": "false", + "parallel-test-types-list-as-string": "API Always", + "separate-test-types-list-as-string": "API Always", + "needs-mypy": "true", + "mypy-folders": "['airflow']", + }, + id="Only API tests and DOCS should run (no provider tests) when only internal_api changed", + ) + ), + ( + pytest.param( + ("tests/api/file.py",), + { + "all-python-versions": "['3.8']", + "all-python-versions-list-as-string": "3.8", + "python-versions": "['3.8']", + "python-versions-list-as-string": "3.8", + "ci-image-build": "true", + "prod-image-build": "false", + "needs-helm-tests": "false", + "run-tests": "true", + "run-amazon-tests": "false", + "docs-build": "false", + "skip-pre-commits": "check-provider-yaml-valid,identity,lint-helm-chart,mypy-airflow,mypy-dev," + "mypy-docs,mypy-providers,ts-compile-format-lint-www", + "upgrade-to-newer-dependencies": "false", + "parallel-test-types-list-as-string": "API Always", + "separate-test-types-list-as-string": "API Always", + "needs-mypy": "true", + "mypy-folders": "['airflow']", + }, + id="Only API tests should run (no provider tests) and no DOCs build when only test API files changed", + ) + ), ( pytest.param( ("airflow/operators/file.py",),