ferruzzi commented on code in PR #55308: URL: https://github.com/apache/airflow/pull/55308#discussion_r2334187452
########## providers/smtp/tests/unit/smtp/hooks/test_smtp.py: ########## @@ -22,17 +22,49 @@ import smtplib import tempfile from email.mime.application import MIMEApplication -from unittest.mock import Mock, call, patch +from unittest import mock +from unittest.mock import AsyncMock, Mock, call, patch +import aiosmtplib import pytest from airflow.exceptions import AirflowException -from airflow.models import Connection from airflow.providers.smtp.hooks.smtp import SmtpHook, build_xoauth2_string +from tests_common.test_utils.version_compat import AIRFLOW_V_3_1_PLUS + +try: + from airflow.sdk import Connection Review Comment: Thanks for the help. I'm not sure I follow what you are suggesting. That was originally `from airflow.models import Connection` and I turned it into ``` try: from airflow.sdk import Connection except (ImportError, ModuleNotFoundError): from airflow.models import Connection # type: ignore[assignment] ``` that you see there in order to use the new location if it can, which is how it is done in several other hooks. The only difference I see is that the other hooks have it wrapped in an `if TYPE_CHECKING` block, but this test was using Connection() directly so it can't be in a TYPE_CHECKING -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org