diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py b/dev/breeze/src/airflow_breeze/utils/selective_checks.py index dba600090288..2cf57200a45e 100644 --- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py +++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py @@ -223,33 +223,42 @@ def __hash__(self): } ) +PYTHON_OPERATOR_FILES = [ + r"^airflow/operators/python.py", + r"^tests/operators/test_python.py", +] + TEST_TYPE_MATCHES = HashableDict( { SelectiveUnitTestTypes.API: [ - r"^airflow/api", - r"^airflow/api_connexion", - r"^tests/api", - r"^tests/api_connexion", + r"^airflow/api/", + r"^airflow/api_connexion/", + r"^airflow/api_internal/", + r"^tests/api/", + r"^tests/api_connexion/", + r"^tests/api_internal/", ], SelectiveUnitTestTypes.CLI: [ - r"^airflow/cli", - r"^tests/cli", + r"^airflow/cli/", + r"^tests/cli/", ], SelectiveUnitTestTypes.OPERATORS: [ - r"^airflow/operators", - r"^tests/operators", + r"^airflow/operators/", + r"^tests/operators/", ], SelectiveUnitTestTypes.PROVIDERS: [ r"^airflow/providers/", r"^tests/system/providers/", r"^tests/providers/", ], - SelectiveUnitTestTypes.PYTHON_VENV: [ - r"^tests/operators/test_python.py", - ], - SelectiveUnitTestTypes.BRANCH_PYTHON_VENV: [ - r"^tests/operators/test_python.py", + SelectiveUnitTestTypes.SERIALIZATION: [ + r"^airflow/serialization/", + r"^tests/serialization/", ], + SelectiveUnitTestTypes.PYTHON_VENV: PYTHON_OPERATOR_FILES, + SelectiveUnitTestTypes.BRANCH_PYTHON_VENV: PYTHON_OPERATOR_FILES, + SelectiveUnitTestTypes.EXTERNAL_PYTHON: PYTHON_OPERATOR_FILES, + SelectiveUnitTestTypes.EXTERNAL_BRANCH_PYTHON: PYTHON_OPERATOR_FILES, SelectiveUnitTestTypes.WWW: [r"^airflow/www", r"^tests/www"], } ) @@ -652,21 +661,14 @@ def _get_test_types_to_run(self) -> list[str]: candidate_test_types: set[str] = {"Always"} matched_files: set[str] = set() - matched_files.update( - self._select_test_type_if_matching(candidate_test_types, SelectiveUnitTestTypes.WWW) - ) - matched_files.update( - self._select_test_type_if_matching(candidate_test_types, SelectiveUnitTestTypes.PROVIDERS) - ) - matched_files.update( - self._select_test_type_if_matching(candidate_test_types, SelectiveUnitTestTypes.CLI) - ) - matched_files.update( - self._select_test_type_if_matching(candidate_test_types, SelectiveUnitTestTypes.OPERATORS) - ) - matched_files.update( - self._select_test_type_if_matching(candidate_test_types, SelectiveUnitTestTypes.API) - ) + for test_type in SelectiveUnitTestTypes: + if test_type not in [ + SelectiveUnitTestTypes.ALWAYS, + SelectiveUnitTestTypes.CORE, + SelectiveUnitTestTypes.OTHER, + SelectiveUnitTestTypes.PLAIN_ASSERTS, + ]: + matched_files.update(self._select_test_type_if_matching(candidate_test_types, test_type)) kubernetes_files = self._matching_files( FileGroupForCi.KUBERNETES_FILES, CI_FILE_GROUP_MATCHES, CI_FILE_GROUP_EXCLUDES diff --git a/dev/breeze/tests/test_selective_checks.py b/dev/breeze/tests/test_selective_checks.py index 6198cc59cd24..495c98fd877a 100644 --- a/dev/breeze/tests/test_selective_checks.py +++ b/dev/breeze/tests/test_selective_checks.py @@ -161,6 +161,53 @@ def assert_outputs_are_printed(expected_outputs: dict[str, str], stderr: str): id="Only Operator tests and DOCS should run", ) ), + ( + pytest.param( + ("airflow/operators/python.py",), + { + "affected-providers-list-as-string": None, + "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-dev," + "mypy-docs,mypy-providers,ts-compile-format-lint-www", + "upgrade-to-newer-dependencies": "false", + "parallel-test-types-list-as-string": "Always BranchExternalPython BranchPythonVenv " + "ExternalPython Operators PythonVenv", + }, + id="Only Python tests", + ) + ), + ( + pytest.param( + ("airflow/serialization/python.py",), + { + "affected-providers-list-as-string": None, + "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-dev," + "mypy-docs,mypy-providers,ts-compile-format-lint-www", + "upgrade-to-newer-dependencies": "false", + "parallel-test-types-list-as-string": "Always Serialization", + }, + id="Only Serialization tests", + ) + ), ( pytest.param( (