drewrukin commented on code in PR #74185:
URL: https://github.com/apache/airflow/pull/74185#discussion_r4505686107
##########
providers/smtp/tests/unit/smtp/hooks/test_smtp.py:
##########
@@ -720,6 +753,61 @@ async def test_async_connection(
assert mock_smtp_client.auth_login.await_count == 1
mock_smtp_client.auth_login.assert_awaited_once_with(SMTP_LOGIN,
SMTP_PASSWORD)
+ @pytest.mark.parametrize("failed_step", ["starttls", "ehlo", "auth_login",
"auth_xoauth2"])
+ @pytest.mark.parametrize("cleanup_fails", [False, True])
+ async def test_discards_failed_setup(self, mock_get_connection,
failed_step, cleanup_fails):
+ failed_client = mock.create_autospec(aiosmtplib.SMTP, instance=True)
+ healthy_client = mock.create_autospec(aiosmtplib.SMTP, instance=True)
+ for client in (failed_client, healthy_client):
+ client.auth_login = AsyncMock()
+ client.auth_xoauth2 = AsyncMock()
+ setup_error = OSError("setup failed")
Review Comment:
Handled in 686548ece8: added asyncio.CancelledError coverage to both async
setup-failure tests, including cleanup failures. The assertions protect client
cleanup and propagation of the original cancellation. The branch is rebased
onto current main; the focused SMTP tests and the required Breeze test suites
pass.
---
Drafted-by: Codex (GPT-5) (no human review 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]