@@ -46,7 +46,6 @@ async def test_nested_timeouts(self):
46
46
self .assertTrue (cm2 .expired ())
47
47
48
48
async def test_waiter_cancelled (self ):
49
- loop = asyncio .get_running_loop ()
50
49
cancelled = False
51
50
with self .assertRaises (TimeoutError ):
52
51
async with asyncio .timeout (0.01 ):
@@ -59,39 +58,26 @@ async def test_waiter_cancelled(self):
59
58
60
59
async def test_timeout_not_called (self ):
61
60
loop = asyncio .get_running_loop ()
62
- t0 = loop .time ()
63
61
async with asyncio .timeout (10 ) as cm :
64
62
await asyncio .sleep (0.01 )
65
63
t1 = loop .time ()
66
64
67
65
self .assertFalse (cm .expired ())
68
- # 2 sec for slow CI boxes
69
- self .assertLess (t1 - t0 , 2 )
70
66
self .assertGreater (cm .when (), t1 )
71
67
72
68
async def test_timeout_disabled (self ):
73
- loop = asyncio .get_running_loop ()
74
- t0 = loop .time ()
75
69
async with asyncio .timeout (None ) as cm :
76
70
await asyncio .sleep (0.01 )
77
- t1 = loop .time ()
78
71
79
72
self .assertFalse (cm .expired ())
80
73
self .assertIsNone (cm .when ())
81
- # 2 sec for slow CI boxes
82
- self .assertLess (t1 - t0 , 2 )
83
74
84
75
async def test_timeout_at_disabled (self ):
85
- loop = asyncio .get_running_loop ()
86
- t0 = loop .time ()
87
76
async with asyncio .timeout_at (None ) as cm :
88
77
await asyncio .sleep (0.01 )
89
- t1 = loop .time ()
90
78
91
79
self .assertFalse (cm .expired ())
92
80
self .assertIsNone (cm .when ())
93
- # 2 sec for slow CI boxes
94
- self .assertLess (t1 - t0 , 2 )
95
81
96
82
async def test_timeout_zero (self ):
97
83
loop = asyncio .get_running_loop ()
@@ -101,8 +87,6 @@ async def test_timeout_zero(self):
101
87
await asyncio .sleep (10 )
102
88
t1 = loop .time ()
103
89
self .assertTrue (cm .expired ())
104
- # 2 sec for slow CI boxes
105
- self .assertLess (t1 - t0 , 2 )
106
90
self .assertTrue (t0 <= cm .when () <= t1 )
107
91
108
92
async def test_timeout_zero_sleep_zero (self ):
@@ -113,8 +97,6 @@ async def test_timeout_zero_sleep_zero(self):
113
97
await asyncio .sleep (0 )
114
98
t1 = loop .time ()
115
99
self .assertTrue (cm .expired ())
116
- # 2 sec for slow CI boxes
117
- self .assertLess (t1 - t0 , 2 )
118
100
self .assertTrue (t0 <= cm .when () <= t1 )
119
101
120
102
async def test_timeout_in_the_past_sleep_zero (self ):
@@ -125,8 +107,6 @@ async def test_timeout_in_the_past_sleep_zero(self):
125
107
await asyncio .sleep (0 )
126
108
t1 = loop .time ()
127
109
self .assertTrue (cm .expired ())
128
- # 2 sec for slow CI boxes
129
- self .assertLess (t1 - t0 , 2 )
130
110
self .assertTrue (t0 >= cm .when () <= t1 )
131
111
132
112
async def test_foreign_exception_passed (self ):
0 commit comments