fix: Address Mypy issue which is causing CI to fail (#25494)

This commit is contained in:
John Bodley 2023-10-02 14:32:21 -07:00 committed by GitHub
parent 0d0a81c0d2
commit 36ed617090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -30,6 +30,8 @@ from sqlalchemy.types import (
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 (
@ -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")