jroachgolf84 opened a new issue, #72268:
URL: https://github.com/apache/airflow/issues/72268

   ## Description
   
   > This is an issue that is reserved for the Airflow Summit "Contributors" 
Workshop. This is denoted with the label `contributors-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.
   
   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`](https://github.com/apache/airflow/blob/main/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_management` wrapped hook method called with 
`use_managed_conn` false and no open connection raises 
`ConnectionNotOpenedException`, and the message points the caller at 
`hook.get_managed_conn()`
   - the same call with a connection already open delegates through to the 
wrapped function and returns its result
   - with `use_managed_conn` true the decorator opens a managed connection 
rather than raising, and the connection is set on the hook for the duration of 
the call
   - `ConnectionNotOpenedException` derives from `AirflowException`, 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
   
   1. Add the test module at the path in the table above.
   2. Remove the corresponding entry from `OVERLOOKED_TESTS` in 
`airflow-core/tests/unit/always/test_project_structure.py`
   3. This test should pass:
   
   ```bash
   breeze testing providers-tests 
providers/sftp/tests/unit/sftp/test_exceptions.py
   ```
   
   
   ---
   Drafted-by: Claude Code (Opus 5); reviewed and edited by @jroachgolf84 
before posting.
   


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