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

   While adding the missing unit tests for 
`airflow/providers/amazon/aws/exceptions.py` (listed in `OVERLOOKED_TESTS` in 
`test_project_structure.py`, tracked in #35442), the pickle round-trip tests 
failed for two of the exceptions:
   
   - `EcsTaskFailToStart.__reduce__` returns `(EcsTaskFailToStart, 
(self.message))`. The second item is a plain string instead of a one-element 
tuple, so `pickle.dumps()` raises `PicklingError: second item of the tuple 
returned by __reduce__ must be a tuple`. The method was added in #22002, right 
after #21441 fixed the same problem for `EcsOperatorError`, and has never 
worked.
   - `WaiterTerminalFailure` (added in #72455) keeps `last_response` outside 
`args`, so unpickling calls `WaiterTerminalFailure(message)` and fails with 
`TypeError: __init__() missing 1 required positional argument: 'last_response'`.
   
   **Changes**
   
   - `exceptions.py`: return a one-element tuple from 
`EcsTaskFailToStart.__reduce__`; give `WaiterTerminalFailure` a `__reduce__` 
that carries `last_response`, in the same style as the ECS exceptions
   - `tests/unit/amazon/aws/test_exceptions.py` (new): message and attribute 
handling plus pickle round-trips for the exceptions that carry extra state, and 
inheritance, message, and round-trip checks for the plain `AirflowException` 
subclasses
   - `test_project_structure.py`: remove the module from `OVERLOOKED_TESTS`
   
   **Testing**
   
   - `providers/amazon`: `tests/unit/amazon/aws/test_exceptions.py`, 
`tests/unit/amazon/aws/utils/test_waiter_with_logging.py`, 
`tests/unit/amazon/aws/hooks/test_ecs.py`, 
`tests/unit/amazon/aws/operators/test_ecs.py`
   - `airflow-core`: `tests/unit/always/test_project_structure.py`
   - prek hooks on the changed files
   
   related: #35442
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Claude Fable 5.1) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions).
 I reviewed and understand all changes; the tests were run locally as listed 
above.
   
   ---
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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