@@ -35,7 +35,6 @@ class LibevConnectionTest(ReactorTestMixin, unittest.TestCase):
35
35
36
36
connection_class = LibevConnection
37
37
socket_attr_name = '_socket'
38
- loop_attr_name = '_libevloop'
39
38
null_handle_function_args = None , 0
40
39
41
40
def setUp (self ):
@@ -62,7 +61,7 @@ def test_watchers_are_finished(self):
62
61
Test for asserting that watchers are closed in LibevConnection
63
62
64
63
This test simulates a process termination without calling cluster.shutdown(), which would trigger
65
- LibevConnection._libevloop ._cleanup. It will check the watchers have been closed
64
+ _global_loop ._cleanup. It will check the watchers have been closed
66
65
Finally it will restore the LibevConnection reactor so it doesn't affect
67
66
the rest of the tests
68
67
@@ -72,24 +71,25 @@ def test_watchers_are_finished(self):
72
71
73
72
@test_category connection
74
73
"""
75
- with patch .object (LibevConnection ._libevloop , "_thread" ),\
76
- patch .object (LibevConnection ._libevloop , "notify" ):
74
+ from cassandra .io .libevreactor import _global_loop
75
+ with patch .object (_global_loop , "_thread" ),\
76
+ patch .object (_global_loop , "notify" ):
77
77
78
78
self .make_connection ()
79
79
80
80
# We have to make a copy because the connections shouldn't
81
81
# be alive when we verify them
82
- live_connections = set (LibevConnection . _libevloop ._live_conns )
82
+ live_connections = set (_global_loop ._live_conns )
83
83
84
84
# This simulates the process ending without cluster.shutdown()
85
85
# being called, then with atexit _cleanup for libevreactor would
86
86
# be called
87
- libev__cleanup (weakref . ref ( LibevConnection . _libevloop ) )
87
+ libev__cleanup (_global_loop )
88
88
for conn in live_connections :
89
89
self .assertTrue (conn ._write_watcher .stop .mock_calls )
90
90
self .assertTrue (conn ._read_watcher .stop .mock_calls )
91
91
92
- LibevConnection . _libevloop ._shutdown = False
92
+ _global_loop ._shutdown = False
93
93
94
94
95
95
class LibevTimerPatcher (unittest .TestCase ):
@@ -125,7 +125,8 @@ def create_timer(self):
125
125
126
126
@property
127
127
def _timers (self ):
128
- return self .connection ._libevloop ._timers
128
+ from cassandra .io .libevreactor import _global_loop
129
+ return _global_loop ._timers
129
130
130
131
def make_connection (self ):
131
132
c = LibevConnection ('1.2.3.4' , cql_version = '3.0.1' )
0 commit comments