File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 15
15
check-env :
16
16
python -c " import cython; (cython.__version__ < '0.24') and exit(1)"
17
17
18
+
18
19
clean-libuv :
19
20
git -C vendor/libuv clean -dfX
20
21
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ async def run():
111
111
delta = self .loop .run_until_complete (run ())
112
112
self .assertTrue (delta > 0.049 and delta < 0.6 )
113
113
114
- def test_call_later (self ):
114
+ def test_call_later_1 (self ):
115
115
calls = []
116
116
117
117
def cb (inc = 10 , stop = False ):
@@ -142,6 +142,20 @@ def cb(inc=10, stop=False):
142
142
143
143
self .assertFalse (self .loop .is_running ())
144
144
145
+ def test_call_later_2 (self ):
146
+ # Test that loop.call_later triggers an update of
147
+ # libuv cached time.
148
+
149
+ async def main ():
150
+ await asyncio .sleep (0.001 )
151
+ time .sleep (0.01 )
152
+ await asyncio .sleep (0.01 )
153
+
154
+ started = time .monotonic ()
155
+ self .loop .run_until_complete (main ())
156
+ delta = time .monotonic () - started
157
+ self .assertGreater (delta , 0.019 )
158
+
145
159
def test_call_later_negative (self ):
146
160
calls = []
147
161
Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ cdef class UVTimer(UVHandle):
45
45
self ._ensure_alive()
46
46
47
47
if self .running == 0 :
48
+ # Update libuv internal time.
49
+ uv.uv_update_time(self ._loop.uvloop) # void
50
+
48
51
err = uv.uv_timer_start(< uv.uv_timer_t* > self ._handle,
49
52
__uvtimer_callback,
50
53
self .timeout, 0 )
You can’t perform that action at this time.
0 commit comments