shahar1 opened a new pull request, #76658:
URL: https://github.com/apache/airflow/pull/76658

   ### Why
   
   `publish_docs_to_s3.py` creates its S3 and CloudFront clients when Python 
imports the module. `boto3` then loads the AWS credentials during the import.
   
   If the local AWS profile cannot load, the import fails. A profile that uses 
`aws login` needs `botocore[crt]`, which Breeze does not install. The error is:
   
   ```
   botocore.exceptions.MissingDependencyException: Missing Dependency: Using 
the login credential provider requires an additional dependency.
   ```
   
   Thus, pytest cannot collect `test_release_management_commands.py`, and all 
of its tests stop. These tests do not use AWS.
   
   ### How
   
   The module now creates each client on first use, through `get_s3_client()` 
and `get_cloudfront_client()`. Each function keeps one client per process, as 
the module-level clients did.
   
   The change does not add `botocore[crt]`. A publish command that uses a 
profile with `aws login` still needs that dependency. It now fails when it 
calls AWS, not when Python imports the module.
   
   ### Tests
   
   The new test `test_import_creates_no_aws_clients` executes the module with 
`boto3.client` mocked. It checks that the import creates no client. The test 
does not use AWS.
   
   | Check | Result |
   |---|---|
   | New test on the old source | Failed: `Expected 'client' to not have been 
called. Called 2 times.` |
   | New test on the new source | Passed |
   | `test_release_management_commands.py` with a local `aws login` profile, 
new source | Collected and passed |
   | `dev/breeze/tests` without `integration_tests`, no 
`.build/.suppress_colour` | 2548 passed, 3 failed |
   | `dev/breeze/tests` without `integration_tests`, with 
`.build/.suppress_colour` | 2550 passed, 1 failed |
   | `prek`, pre-commit and manual stages | Passed |
   
   The failed tests are not related to this change. Their results depend on 
`.build/.suppress_colour`:
   
   - The 3 `test_publish_stable_version_docs` cases fail when the file does not 
exist. They also fail on the base commit.
   - `test_stale_worktree_cleanup_keeps_containers_when_path_cannot_be_checked` 
fails when the file exists. It also fails on the base commit.
   
   This PR does not change these tests.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5.5)
   
   Generated-by: Claude Code (Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01BVx6g6v9hW7wi1tV4bqvrp
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to