Skip to content

Commit ba4e804

Browse files
committed
Fix test_ipv6 to test if asyncore is present
asyncore is not present after 3.12
1 parent 0de2cd8 commit ba4e804

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

tests/integration/long/test_ipv6.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,25 @@
1616
from ccmlib import common
1717

1818
from cassandra.cluster import NoHostAvailable
19-
from cassandra.io.asyncorereactor import AsyncoreConnection
19+
20+
try:
21+
from cassandra.io.asyncorereactor import AsyncoreConnection
22+
except ImportError:
23+
AsyncoreConnection = None
2024

2125
from tests import is_monkey_patched
2226
from tests.integration import use_cluster, remove_cluster, TestCluster
2327

28+
try:
29+
from cassandra.io.libevreactor import LibevConnection
30+
except ImportError:
31+
LibevConnection = None
32+
33+
2434
if is_monkey_patched():
25-
LibevConnection = -1
26-
AsyncoreConnection = -1
27-
else:
28-
try:
29-
from cassandra.io.libevreactor import LibevConnection
30-
except ImportError:
31-
LibevConnection = None
35+
LibevConnection = None
36+
AsyncoreConnection = None
37+
3238

3339
import unittest
3440

@@ -102,7 +108,7 @@ def setUp(self):
102108
if os.name == "nt":
103109
raise unittest.SkipTest("IPv6 is currently not supported under Windows")
104110

105-
if LibevConnection == -1:
111+
if LibevConnection is None:
106112
raise unittest.SkipTest("Can't test libev with monkey patching")
107113
elif LibevConnection is None:
108114
raise unittest.SkipTest("Libev does not appear to be installed properly")
@@ -116,5 +122,5 @@ def setUp(self):
116122
if os.name == "nt":
117123
raise unittest.SkipTest("IPv6 is currently not supported under Windows")
118124

119-
if AsyncoreConnection == -1:
125+
if AsyncoreConnection is None:
120126
raise unittest.SkipTest("Can't test asyncore with monkey patching")

0 commit comments

Comments
 (0)