@@ -46,7 +46,6 @@ async def test_nested_timeouts(self):
4646 self .assertTrue (cm2 .expired ())
4747
4848 async def test_waiter_cancelled (self ):
49- loop = asyncio .get_running_loop ()
5049 cancelled = False
5150 with self .assertRaises (TimeoutError ):
5251 async with asyncio .timeout (0.01 ):
@@ -59,39 +58,26 @@ async def test_waiter_cancelled(self):
5958
6059 async def test_timeout_not_called (self ):
6160 loop = asyncio .get_running_loop ()
62- t0 = loop .time ()
6361 async with asyncio .timeout (10 ) as cm :
6462 await asyncio .sleep (0.01 )
6563 t1 = loop .time ()
6664
6765 self .assertFalse (cm .expired ())
68- # 2 sec for slow CI boxes
69- self .assertLess (t1 - t0 , 2 )
7066 self .assertGreater (cm .when (), t1 )
7167
7268 async def test_timeout_disabled (self ):
73- loop = asyncio .get_running_loop ()
74- t0 = loop .time ()
7569 async with asyncio .timeout (None ) as cm :
7670 await asyncio .sleep (0.01 )
77- t1 = loop .time ()
7871
7972 self .assertFalse (cm .expired ())
8073 self .assertIsNone (cm .when ())
81- # 2 sec for slow CI boxes
82- self .assertLess (t1 - t0 , 2 )
8374
8475 async def test_timeout_at_disabled (self ):
85- loop = asyncio .get_running_loop ()
86- t0 = loop .time ()
8776 async with asyncio .timeout_at (None ) as cm :
8877 await asyncio .sleep (0.01 )
89- t1 = loop .time ()
9078
9179 self .assertFalse (cm .expired ())
9280 self .assertIsNone (cm .when ())
93- # 2 sec for slow CI boxes
94- self .assertLess (t1 - t0 , 2 )
9581
9682 async def test_timeout_zero (self ):
9783 loop = asyncio .get_running_loop ()
@@ -101,8 +87,6 @@ async def test_timeout_zero(self):
10187 await asyncio .sleep (10 )
10288 t1 = loop .time ()
10389 self .assertTrue (cm .expired ())
104- # 2 sec for slow CI boxes
105- self .assertLess (t1 - t0 , 2 )
10690 self .assertTrue (t0 <= cm .when () <= t1 )
10791
10892 async def test_timeout_zero_sleep_zero (self ):
@@ -113,8 +97,6 @@ async def test_timeout_zero_sleep_zero(self):
11397 await asyncio .sleep (0 )
11498 t1 = loop .time ()
11599 self .assertTrue (cm .expired ())
116- # 2 sec for slow CI boxes
117- self .assertLess (t1 - t0 , 2 )
118100 self .assertTrue (t0 <= cm .when () <= t1 )
119101
120102 async def test_timeout_in_the_past_sleep_zero (self ):
@@ -125,8 +107,6 @@ async def test_timeout_in_the_past_sleep_zero(self):
125107 await asyncio .sleep (0 )
126108 t1 = loop .time ()
127109 self .assertTrue (cm .expired ())
128- # 2 sec for slow CI boxes
129- self .assertLess (t1 - t0 , 2 )
130110 self .assertTrue (t0 >= cm .when () <= t1 )
131111
132112 async def test_foreign_exception_passed (self ):
0 commit comments