Skip to content

Commit 7cd313c

Browse files
committed
Fix: Fix import issues in test/test_connection.py
An import error trying to import connection_cext on Python 2.7 was the cause to not able to run unittests on Python 2.7.
1 parent e2bbafa commit 7cd313c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test_connection.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@
4040
import tests
4141
from . import PY2
4242

43-
from mysql.connector.connection_cext import HAVE_CMYSQL, CMySQLConnection
43+
try:
44+
from mysql.connector.connection_cext import HAVE_CMYSQL, CMySQLConnection
45+
except ImportError:
46+
# Test without C Extension
47+
CMySQLConnection = None
48+
HAVE_CMYSQL = False
49+
4450
from mysql.connector.conversion import (MySQLConverterBase, MySQLConverter)
4551
from mysql.connector import (connect, connection, network, errors,
4652
constants, cursor, abstracts, catch23)

0 commit comments

Comments
 (0)