16
16
from ccmlib import common
17
17
18
18
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
20
24
21
25
from tests import is_monkey_patched
22
26
from tests .integration import use_cluster , remove_cluster , TestCluster
23
27
28
+ try :
29
+ from cassandra .io .libevreactor import LibevConnection
30
+ except ImportError :
31
+ LibevConnection = None
32
+
33
+
24
34
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
+
32
38
33
39
import unittest
34
40
@@ -102,7 +108,7 @@ def setUp(self):
102
108
if os .name == "nt" :
103
109
raise unittest .SkipTest ("IPv6 is currently not supported under Windows" )
104
110
105
- if LibevConnection == - 1 :
111
+ if LibevConnection is None :
106
112
raise unittest .SkipTest ("Can't test libev with monkey patching" )
107
113
elif LibevConnection is None :
108
114
raise unittest .SkipTest ("Libev does not appear to be installed properly" )
@@ -116,5 +122,5 @@ def setUp(self):
116
122
if os .name == "nt" :
117
123
raise unittest .SkipTest ("IPv6 is currently not supported under Windows" )
118
124
119
- if AsyncoreConnection == - 1 :
125
+ if AsyncoreConnection is None :
120
126
raise unittest .SkipTest ("Can't test asyncore with monkey patching" )
0 commit comments