Skip to content

Fix excluded provider tests crashing pytest#63918

Merged
potiuk merged 1 commit intoapache:mainfrom
Dev-iL:2603/pytest_exclude
Mar 19, 2026
Merged

Fix excluded provider tests crashing pytest#63918
potiuk merged 1 commit intoapache:mainfrom
Dev-iL:2603/pytest_exclude

Conversation

@Dev-iL
Copy link
Copy Markdown
Collaborator

@Dev-iL Dev-iL commented Mar 19, 2026

related: #63793, #63870

Summary

  • Skip Breeze provider test runs before Docker startup when every selected test path is excluded or suspended for the current Python version.
  • Preserve explicit pytest path runs such as test_type="None" so the earlier skip regression does not come back.

Details

#63793 fixed one failure mode for Python-version-excluded providers by skipping when pytest ended up with no test directories. #63870 then reverted that broader filtering because it also skipped valid test_type="None" runs where users passed explicit test paths.

This change keeps the skip, but moves the decision earlier and makes it specific to provider exclusion data. A new are_all_test_paths_excluded() helper checks the test directories implied by the selected provider test type against the excluded and suspended provider sets. When every generated path is excluded for the current Python version, _run_test now returns a skip result immediately, before any Docker cleanup or docker compose run calls.

Because the new check only applies to generated provider test paths, explicit pytest path invocations still run normally. The added Breeze tests cover the full-exclusion skip path, the partial-exclusion path, and the test_type="None" regression case from #63870.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Opus 4.6 following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

When running provider tests (e.g., Providers[google]) on a Python version
where the provider is excluded, generate_args_for_pytest removes the test
directories but the skip check in _run_test only triggers when its own
--ignore filter removes something. Since the directories are already gone,
pytest runs with zero test directories and crashes on unrecognized custom
arguments like --run-db-tests-only.

Add are_all_test_paths_excluded() that explicitly checks whether all test
paths for the given test type are in the excluded/suspended provider set,
using the same provider.yaml data. Call it early in _run_test to skip
before any Docker operations.
@Dev-iL
Copy link
Copy Markdown
Collaborator Author

Dev-iL commented Mar 19, 2026

@wjddn279 Could you please take a look?

@potiuk potiuk merged commit bc78841 into apache:main Mar 19, 2026
256 of 257 checks passed
@Dev-iL Dev-iL deleted the 2603/pytest_exclude branch March 19, 2026 10:49
@github-actions
Copy link
Copy Markdown

Backport failed to create: v3-1-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-1-test Commit Link

You can attempt to backport this manually by running:

cherry_picker bc78841 v3-1-test

This should apply the commit to the v3-1-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

fat-catTW pushed a commit to fat-catTW/airflow that referenced this pull request Mar 22, 2026
When running provider tests (e.g., Providers[google]) on a Python version
where the provider is excluded, generate_args_for_pytest removes the test
directories but the skip check in _run_test only triggers when its own
--ignore filter removes something. Since the directories are already gone,
pytest runs with zero test directories and crashes on unrecognized custom
arguments like --run-db-tests-only.

Add are_all_test_paths_excluded() that explicitly checks whether all test
paths for the given test type are in the excluded/suspended provider set,
using the same provider.yaml data. Call it early in _run_test to skip
before any Docker operations.
Suraj-kumar00 pushed a commit to Suraj-kumar00/airflow that referenced this pull request Apr 7, 2026
When running provider tests (e.g., Providers[google]) on a Python version
where the provider is excluded, generate_args_for_pytest removes the test
directories but the skip check in _run_test only triggers when its own
--ignore filter removes something. Since the directories are already gone,
pytest runs with zero test directories and crashes on unrecognized custom
arguments like --run-db-tests-only.

Add are_all_test_paths_excluded() that explicitly checks whether all test
paths for the given test type are in the excluded/suspended provider set,
using the same provider.yaml data. Call it early in _run_test to skip
before any Docker operations.
abhijeets25012-tech pushed a commit to abhijeets25012-tech/airflow that referenced this pull request Apr 9, 2026
When running provider tests (e.g., Providers[google]) on a Python version
where the provider is excluded, generate_args_for_pytest removes the test
directories but the skip check in _run_test only triggers when its own
--ignore filter removes something. Since the directories are already gone,
pytest runs with zero test directories and crashes on unrecognized custom
arguments like --run-db-tests-only.

Add are_all_test_paths_excluded() that explicitly checks whether all test
paths for the given test type are in the excluded/suspended provider set,
using the same provider.yaml data. Call it early in _run_test to skip
before any Docker operations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants