Skip to content

Commit 3a855fc

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 3a855fc

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

tests/integration/standard/test_connection.py

Lines changed: 6 additions & 2 deletions
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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,22 @@
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
11-
from cassandra.io.geventreactor import GeventConnection
12-
from cassandra.io.eventletreactor import EventletConnection
13-
from cassandra.io.asyncioreactor import AsyncioConnection
12+
supported_connection_classes = [LibevConnection, TwistedConnection]
13+
try:
14+
from cassandra.io.asyncorereactor import AsyncoreConnection
15+
supported_connection_classes += [AsyncoreConnection]
16+
except ImportError:
17+
pass
18+
19+
#from cassandra.io.geventreactor import GeventConnection
20+
#from cassandra.io.eventletreactor import EventletConnection
21+
#from cassandra.io.asyncioreactor import AsyncioConnection
1422

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

1926

2027
class ScyllaCloudConfigTests(TestCase):

0 commit comments

Comments
 (0)