From e84e13472bfef33d6763e98a9795e232deac0dbc Mon Sep 17 00:00:00 2001 From: John Bodley <4567245+john-bodley@users.noreply.github.com> Date: Mon, 2 Oct 2023 11:46:33 -0700 Subject: [PATCH 1/2] fix: Address Mypy issue which is causing CI to fail --- tests/unit_tests/db_engine_specs/test_clickhouse.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit_tests/db_engine_specs/test_clickhouse.py b/tests/unit_tests/db_engine_specs/test_clickhouse.py index 6dfeddaf37cf..7fec9e07fc53 100644 --- a/tests/unit_tests/db_engine_specs/test_clickhouse.py +++ b/tests/unit_tests/db_engine_specs/test_clickhouse.py @@ -20,6 +20,8 @@ from unittest.mock import Mock import pytest +from urllib3.connection import HTTPConnection +from urllib3.exceptions import NewConnectionError from sqlalchemy.types import ( Boolean, Date, @@ -56,14 +58,12 @@ def test_convert_dttm( def test_execute_connection_error() -> None: - from urllib3.exceptions import NewConnectionError - from superset.db_engine_specs.clickhouse import ClickHouseEngineSpec from superset.db_engine_specs.exceptions import SupersetDBAPIDatabaseError cursor = Mock() cursor.execute.side_effect = NewConnectionError( - "Dummypool", "Exception with sensitive data" + HTTPConnection("localhost"), "Exception with sensitive data" ) with pytest.raises(SupersetDBAPIDatabaseError) as ex: ClickHouseEngineSpec.execute(cursor, "SELECT col1 from table1") From 4ac7a7b7234315fbe6c4d6eeea6be432259e4c92 Mon Sep 17 00:00:00 2001 From: John Bodley <4567245+john-bodley@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:20:57 -0700 Subject: [PATCH 2/2] Fix import order --- tests/unit_tests/db_engine_specs/test_clickhouse.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit_tests/db_engine_specs/test_clickhouse.py b/tests/unit_tests/db_engine_specs/test_clickhouse.py index 7fec9e07fc53..3f28341f2643 100644 --- a/tests/unit_tests/db_engine_specs/test_clickhouse.py +++ b/tests/unit_tests/db_engine_specs/test_clickhouse.py @@ -20,8 +20,6 @@ from unittest.mock import Mock import pytest -from urllib3.connection import HTTPConnection -from urllib3.exceptions import NewConnectionError from sqlalchemy.types import ( Boolean, Date, @@ -32,6 +30,8 @@ String, TypeEngine, ) +from urllib3.connection import HTTPConnection +from urllib3.exceptions import NewConnectionError from superset.utils.core import GenericDataType from tests.unit_tests.db_engine_specs.utils import (