File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515check-env :
1616 python -c " import cython; (cython.__version__ < '0.24') and exit(1)"
1717
18+
1819clean-libuv :
1920 git -C vendor/libuv clean -dfX
2021
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ async def run():
111111 delta = self .loop .run_until_complete (run ())
112112 self .assertTrue (delta > 0.049 and delta < 0.6 )
113113
114- def test_call_later (self ):
114+ def test_call_later_1 (self ):
115115 calls = []
116116
117117 def cb (inc = 10 , stop = False ):
@@ -142,6 +142,20 @@ def cb(inc=10, stop=False):
142142
143143 self .assertFalse (self .loop .is_running ())
144144
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+
145159 def test_call_later_negative (self ):
146160 calls = []
147161
Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ cdef class UVTimer(UVHandle):
4545 self ._ensure_alive()
4646
4747 if self .running == 0 :
48+ # Update libuv internal time.
49+ uv.uv_update_time(self ._loop.uvloop) # void
50+
4851 err = uv.uv_timer_start(< uv.uv_timer_t* > self ._handle,
4952 __uvtimer_callback,
5053 self .timeout, 0 )
You can’t perform that action at this time.
0 commit comments