Skip to content

Commit dcd9d02

Browse files
committed
fix: blue green deployment test
1 parent ac20df5 commit dcd9d02

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

aws_advanced_python_wrapper/mysql_driver_dialect.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
CMYSQL_ENABLED = True
3636

37-
except ImportError as exc:
37+
except ImportError:
3838
# Do nothing
3939
pass
4040

@@ -175,8 +175,7 @@ def get_connection_from_obj(self, obj: object) -> Any:
175175
return None
176176

177177
def transfer_session_state(self, from_conn: Connection, to_conn: Connection):
178-
if (isinstance(from_conn, CMySQLConnection) or isinstance(from_conn, MySQLConnection)) and (
179-
isinstance(to_conn, CMySQLConnection) or isinstance(to_conn, MySQLConnection)):
178+
if MySQLDriverDialect._is_mysql_connection(from_conn) and MySQLDriverDialect._is_mysql_connection(to_conn):
180179
to_conn.autocommit = from_conn.autocommit
181180

182181
def ping(self, conn: Connection) -> bool:

tests/integration/container/test_blue_green_deployment.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
import mysql.connector
3232
import psycopg
33-
from mysql.connector import CMySQLConnection, MySQLConnection
3433

3534
from aws_advanced_python_wrapper.mysql_driver_dialect import MySQLDriverDialect
3635
from aws_advanced_python_wrapper.pg_driver_dialect import PgDriverDialect
@@ -458,7 +457,7 @@ def close_connection(self, conn: Optional[Connection]):
458457
def is_closed(self, conn: Connection) -> bool:
459458
if isinstance(conn, psycopg.Connection):
460459
return self.pg_dialect.is_closed(conn)
461-
elif isinstance(conn, CMySQLConnection) or isinstance(conn, MySQLConnection):
460+
elif MySQLDriverDialect._is_mysql_connection(conn):
462461
return self.mysql_dialect.is_closed(conn)
463462
elif isinstance(conn, AwsWrapperConnection):
464463
return conn.is_closed

0 commit comments

Comments
 (0)