rokadepiyush49-rgb opened a new pull request, #77510:
URL: https://github.com/apache/airflow/pull/77510

   Nine assertions in provider tests looked like this:
   
   ```python
   assert mock_emit.assert_called_once
   ```
   
   The method is never called. A bound method is always truthy, so the line 
passes whatever the mock did. This PR calls the helpers directly 
(`mock_emit.assert_called_once()`). Adding `()` while keeping the `assert` 
would not work, because the `assert_*` helpers return `None` and the assertion 
would always fail.
   
   Fixed locations:
   
   | Provider | File | Lines |
   |---|---|---|
   | amazon | `tests/unit/amazon/aws/utils/test_connection_wrapper.py` | 240, 
243, 245 |
   | amazon | `tests/unit/amazon/aws/hooks/test_base_aws.py` | 1121 |
   | openlineage | `tests/unit/openlineage/plugins/test_listener.py` | 2292, 
2546, 3026 |
   | slack | `tests/unit/slack/hooks/test_slack_webhook.py` | 424, 438 |
   
   **Testing**
   
   - The affected tests pass with the fix (26 parametrized cases across 
`test_get_botocore_config`, `test_get_session`, the three 
`*_for_db_task_instance_model*` listener tests, and the two Slack `send_dict` 
invalid-input tests).
   - As a sanity check, I flipped each fixed assertion locally 
(`assert_called_once()` ↔ `assert_not_called()`). All 26 cases then failed, so 
every line now really checks something.
   - `ruff check` / `ruff format --check` (0.17.3) are clean.
   
   None of the fixed assertions was hiding a real bug. The code under test 
already behaved as each test expected.
   
   Not changed: `task-sdk/tests/task_sdk/execution_time/test_supervisor.py:985` 
(`assert spy.called_with(...)  # noqa: PGH005`) looks similar, but `spy` is a 
`kgb` `FunctionSpy`. Its `called_with()` is a real method that returns a bool, 
so that assertion already works (it fails if given a different `ti_id`). The 
`noqa` only silences a ruff false positive.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   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)
   


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