Skip to content

Commit 7a10332

Browse files
committed
handle the case asyncore isn't available
since asyncore isn't available in python 3.12, we should be gracfully handle it, and enable any other event loop implementions to work
1 parent c7b600c commit 7a10332

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

tests/integration/standard/test_connection.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@
2626

2727
from cassandra import ConsistencyLevel, OperationTimedOut
2828
from cassandra.cluster import NoHostAvailable, ConnectionShutdown, ExecutionProfile, EXEC_PROFILE_DEFAULT
29-
import cassandra.io.asyncorereactor
30-
from cassandra.io.asyncorereactor import AsyncoreConnection
29+
30+
try:
31+
from cassandra.io.asyncorereactor import AsyncoreConnection
32+
except ImportError:
33+
AsyncoreConnection = None
34+
3135
from cassandra.protocol import QueryMessage
3236
from cassandra.connection import Connection
3337
from cassandra.policies import HostFilterPolicy, RoundRobinPolicy, HostStateListener

tests/integration/standard/test_scylla_cloud.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66

77
from tests.integration import use_cluster
88
from cassandra.cluster import Cluster, TwistedConnection
9-
from cassandra.io.asyncorereactor import AsyncoreConnection
9+
10+
1011
from cassandra.io.libevreactor import LibevConnection
1112
from cassandra.io.geventreactor import GeventConnection
1213
from cassandra.io.eventletreactor import EventletConnection
1314
from cassandra.io.asyncioreactor import AsyncioConnection
15+
supported_connection_classes = [LibevConnection, TwistedConnection]
16+
try:
17+
from cassandra.io.asyncorereactor import AsyncoreConnection
18+
supported_connection_classes += [AsyncoreConnection]
19+
except ImportError:
20+
pass
1421

15-
supported_connection_classes = [AsyncoreConnection, LibevConnection, TwistedConnection]
1622
# need to run them with specific configuration like `gevent.monkey.patch_all()` or under async functions
1723
unsupported_connection_classes = [GeventConnection, AsyncioConnection, EventletConnection]
1824

0 commit comments

Comments
 (0)