Skip to content

Fix test infrastructure for Python-version-excluded providers#63793

Merged
potiuk merged 3 commits intoapache:mainfrom
Dev-iL:2603/fix-excluded-provider-tests
Mar 17, 2026
Merged

Fix test infrastructure for Python-version-excluded providers#63793
potiuk merged 3 commits intoapache:mainfrom
Dev-iL:2603/fix-excluded-provider-tests

Conversation

@Dev-iL
Copy link
Collaborator

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

Summary

  • Fix provider test runner to skip gracefully when all test directories are excluded for the current Python version.
  • Fix PROD image docker tests to read provider.yaml exclusions and filter expected providers/imports based on the image's Python version.

Details

Skip provider tests when all test directories are excluded

When running provider test suites (e.g., Providers[google]) on a Python version where that provider is excluded, generate_args_for_pytest removes the test folders upstream. However, the skip check in _run_test only triggered when the --ignore filter itself removed something. Since folders were already gone, the guard condition was never met, leaving pytest with only flags and no test directories — causing it to crash on unrecognized custom arguments.

The fix removes the overly strict guard so the skip fires whenever no test directories remain in the args.

Fix PROD image docker tests for excluded providers

The docker tests expected all providers from prod_image_installed_providers.txt to be present, but providers like google and amazon may declare excluded-python-versions in their provider.yaml. The tests now read these exclusions and filter expected providers and imports based on the Docker image's Python version.

related: #63520


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.

@boring-cyborg boring-cyborg bot added area:dev-tools area:docker-tests area:production-image Production image improvements and fixes backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch labels Mar 17, 2026
@Dev-iL Dev-iL force-pushed the 2603/fix-excluded-provider-tests branch 3 times, most recently from 48f3621 to c67db2a Compare March 17, 2026 08:46
Dev-iL added 3 commits March 17, 2026 12:12
When running Providers[google] or Providers[amazon] on Python 3.14,
generate_args_for_pytest removes the test folders for excluded
providers, but the skip check in _run_test only triggered when the
--ignore filter itself removed something. Since the folders were
already removed upstream, the guard condition was never met, leaving
pytest with only flags and no test directories — causing it to crash
on unrecognized custom arguments.

Remove the overly strict guard so the skip fires whenever no test
directories remain in the args.
The docker tests expected all providers from prod_image_installed_providers.txt
to be present, but providers like google and amazon declare
excluded-python-versions in their provider.yaml. On Python 3.14, these
providers are correctly excluded from the PROD image at build time, but
the tests didn't account for this.

Read provider.yaml exclusions and filter expected providers/imports based
on the Docker image's Python version.
get_distribution_specs.py now reads Requires-Python metadata from each
wheel and skips wheels that are incompatible with the running
interpreter. This prevents excluded providers (e.g. amazon on 3.14)
from being passed to pip/uv and installed despite their exclusion.

Also fix the requires-python specifier generation in packages.py:
!=3.14 per PEP 440 only excludes 3.14.0, not 3.14.2. Use !=3.14.*
wildcard to exclude the entire minor version.
@Dev-iL Dev-iL force-pushed the 2603/fix-excluded-provider-tests branch from c67db2a to 51c747a Compare March 17, 2026 10:12
@Dev-iL Dev-iL mentioned this pull request Mar 17, 2026
6 tasks
@potiuk potiuk merged commit 48ec002 into apache:main Mar 17, 2026
134 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 17, 2026
…ders (#63793)

* Skip provider tests when all test directories are excluded

When running Providers[google] or Providers[amazon] on Python 3.14,
generate_args_for_pytest removes the test folders for excluded
providers, but the skip check in _run_test only triggered when the
--ignore filter itself removed something. Since the folders were
already removed upstream, the guard condition was never met, leaving
pytest with only flags and no test directories — causing it to crash
on unrecognized custom arguments.

Remove the overly strict guard so the skip fires whenever no test
directories remain in the args.

* Fix PROD image docker tests for Python-version-excluded providers

The docker tests expected all providers from prod_image_installed_providers.txt
to be present, but providers like google and amazon declare
excluded-python-versions in their provider.yaml. On Python 3.14, these
providers are correctly excluded from the PROD image at build time, but
the tests didn't account for this.

Read provider.yaml exclusions and filter expected providers/imports based
on the Docker image's Python version.

* Skip Python-incompatible provider wheels during PROD image build

get_distribution_specs.py now reads Requires-Python metadata from each
wheel and skips wheels that are incompatible with the running
interpreter. This prevents excluded providers (e.g. amazon on 3.14)
from being passed to pip/uv and installed despite their exclusion.

Also fix the requires-python specifier generation in packages.py:
!=3.14 per PEP 440 only excludes 3.14.0, not 3.14.2. Use !=3.14.*
wildcard to exclude the entire minor version.
(cherry picked from commit 48ec002)

Co-authored-by: Dev-iL <6509619+Dev-iL@users.noreply.github.com>
@github-actions
Copy link

Backport successfully created: v3-1-test

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 PR Link

@Dev-iL Dev-iL deleted the 2603/fix-excluded-provider-tests branch March 17, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools area:docker-tests area:production-image Production image improvements and fixes backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants