neochaotic opened a new pull request, #73289: URL: https://github.com/apache/airflow/pull/73289
The `sftp` provider's `exceptions.py` had no dedicated test module and was not covered indirectly, so it sat on the `OVERLOOKED_TESTS` allowlist in `airflow-core/tests/unit/always/test_project_structure.py`. This is the `sftp`-scoped subset of #35442. The module defines a single exception, `ConnectionNotOpenedException`, so the useful scope is the behaviour that raises it — the `handle_connection_management` decorator in `hooks/sftp.py`, whose branches were uncovered as well. New tests drive the decorator against a small stub hook (no SFTP server needed) and assert: - an unmanaged call with no open connection raises `ConnectionNotOpenedException`, and the message points the caller at `hook.get_managed_conn()`; - an unmanaged call with a connection already open delegates to the wrapped function and returns its result; - a managed call (`use_managed_conn=True`) opens a managed connection and makes it current on the hook instead of raising; - `ConnectionNotOpenedException` derives from `AirflowException` — callers catching the base class rely on that, so narrowing it later would be a breaking change. The `sftp` entry is removed from `OVERLOOKED_TESTS` accordingly. closes: #72268 --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Anthropic) Generated-by: Claude Code 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]
