Repository navigation
Description
Description
One module in the sftp provider has no dedicated test module, and (unlike most entries on the OVERLOOKED_TESTS list) it is not covered indirectly. Nothing under any providers/*/tests/ directory imports it at all:
| Module | Expected test file |
|---|---|
providers/sftp/src/airflow/providers/sftp/exceptions.py |
providers/sftp/tests/unit/sftp/test_exceptions.py |
It is currently suppressed in the OVERLOOKED_TESTS allowlist in airflow-core/tests/unit/always/test_project_structure.py.
This is a scoped subset of the meta issue #35442, limited to the sftp provider.
What should these tests cover?
The module defines a single exception, ConnectionNotOpenedException. Testing the class declaration on its own would be close to worthless, so the useful scope here is the behaviour that raises it, which turns out to be uncovered as well. The only raise site is the handle_connection_management decorator in providers/sftp/src/airflow/providers/sftp/hooks/sftp.py, and no test in providers/sftp/tests/ currently exercises that branch.
Worth covering:
- a
handle_connection_managementwrapped hook method called withuse_managed_connfalse and no open connection raisesConnectionNotOpenedException, and the message points the caller athook.get_managed_conn() - the same call with a connection already open delegates through to the wrapped function and returns its result
- with
use_managed_conntrue the decorator opens a managed connection rather than raising, and the connection is set on the hook for the duration of the call ConnectionNotOpenedExceptionderives fromAirflowException, which matters because callers catching the base class rely on that and narrowing it later would be a breaking change for them
The decorator can be driven against a small stub hook with a mocked connection, so no SFTP server is needed.
Definition of done
- Add the test module at the path in the table above.
- Remove the corresponding entry from
OVERLOOKED_TESTSinairflow-core/tests/unit/always/test_project_structure.py - This test should pass:
breeze testing providers-tests providers/sftp/tests/unit/sftp/test_exceptions.pyDrafted-by: Claude Code (Opus 5); reviewed and edited by @jroachgolf84 before posting.
Activity
jroachgolf84 commentedon Aug 29, 2026
This is an issue that is reserved for the Airflow Summit "Contributors" Workshop. This is denoted with the labelcontributors-workshop. Out of respect for the organizers and participants of this workshop, please do not implement a PR that addresses this issue.If this issue is still open following Airflow Summit, the label will be removed and the issue can be picked up.AkshayKarthickMS commentedon Sep 23, 2026
Hi @jroachgolf84 I see the Airflow Summit workshop reservation is struck through. Is this issue open for contribution now? If so, I'd like to take it.
I've already put together the test module covering the four cases listed above, using a stub hook with a mocked managed connection (no SFTP server needed), and removed the OVERLOOKED_TESTS entry. test_providers_modules_should_have_tests passes with it removed. Happy to open the PR once you confirm.
Add missing tests for sftp exceptions (#72456)