1616from ccmlib import common
1717
1818from 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
2125from tests import is_monkey_patched
2226from 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+
2434if 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
3339import 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