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

   ## Summary
   
   exceptions.py in the sftp provider had no tests. Nothing in 
providers/*/tests/ imported it either, so it wasn't getting covered by accident.
   
   There's not much point in testing the exception class by itself. The one 
place that raises it is the handle_connection_management decorator, which had 
no tests of its own, so this covers the decorator and picks up the exception on 
the way through.
   
   The test walks through four cases. With no open connection and 
use_managed_conn=False, it raises, and the message points you at 
hook.get_managed_conn(). With a connection already open, it just delegates and 
returns. With use_managed_conn=True, it opens a managed connection instead of 
raising, and sets it on the hook for the length of the call. And the exception 
subclasses AirflowException, which is worth pinning down since anyone catching 
the base class is counting on it.
   
   Everything runs against a stub hook, so you don't need an SFTP server to run 
it.
   
   I also removed the OVERLOOKED_TESTS entry.
   
   Closes: #72268
   
   ## Test Plan
   
   The four tests pass against `apache-airflow-providers-sftp` on Airflow 3.3.1 
/ Python 3.12, importing the real decorator and exception. `ruff check` and 
`ruff format --check` pass using Airflow's own ruff configuration.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Tests drafted with Claude Code (Opus 5); reviewed and verified by 
@vitorantoniazzi
   


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