Skip to content

Commit

Permalink
handle the case asyncore isn't available
Browse files Browse the repository at this point in the history
since asyncore isn't available in python 3.12,
we should be gracfully handle it, and enable any other event
loop implementions to work
  • Loading branch information
fruch committed Nov 9, 2023
1 parent e0465d7 commit 7690122
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
8 changes: 6 additions & 2 deletions tests/integration/standard/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@

from cassandra import ConsistencyLevel, OperationTimedOut
from cassandra.cluster import NoHostAvailable, ConnectionShutdown, ExecutionProfile, EXEC_PROFILE_DEFAULT
import cassandra.io.asyncorereactor
from cassandra.io.asyncorereactor import AsyncoreConnection

try:
from cassandra.io.asyncorereactor import AsyncoreConnection
except ImportError:
AsyncoreConnection = None

from cassandra.protocol import QueryMessage
from cassandra.connection import Connection
from cassandra.policies import HostFilterPolicy, RoundRobinPolicy, HostStateListener
Expand Down
19 changes: 13 additions & 6 deletions tests/integration/standard/test_scylla_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@

from tests.integration import use_cluster
from cassandra.cluster import Cluster, TwistedConnection
from cassandra.io.asyncorereactor import AsyncoreConnection


from cassandra.io.libevreactor import LibevConnection
from cassandra.io.geventreactor import GeventConnection
from cassandra.io.eventletreactor import EventletConnection
from cassandra.io.asyncioreactor import AsyncioConnection
supported_connection_classes = [LibevConnection, TwistedConnection]
try:
from cassandra.io.asyncorereactor import AsyncoreConnection
supported_connection_classes += [AsyncoreConnection]
except ImportError:
pass

#from cassandra.io.geventreactor import GeventConnection
#from cassandra.io.eventletreactor import EventletConnection
#from cassandra.io.asyncioreactor import AsyncioConnection

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


class ScyllaCloudConfigTests(TestCase):
Expand Down

0 comments on commit 7690122

Please sign in to comment.