File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -107,13 +107,12 @@ async def test_blocking(self, r):
107107 async def test_blocking_timeout (self , r ):
108108 lock1 = self .get_lock (r , "foo" )
109109 assert await lock1 .acquire (blocking = False )
110- bt = 0.9
110+ bt = 0.2
111111 sleep = 0.05
112112 lock2 = self .get_lock (r , "foo" , sleep = sleep , blocking_timeout = bt )
113113 start = asyncio .get_running_loop ().time ()
114114 assert not await lock2 .acquire ()
115- # The elapsed duration should be less than the total blocking_timeout
116- assert bt >= (asyncio .get_running_loop ().time () - start ) > bt - sleep
115+ assert (asyncio .get_running_loop ().time () - start ) > (bt - sleep )
117116 await lock1 .release ()
118117
119118 async def test_context_manager (self , r ):
Original file line number Diff line number Diff line change @@ -101,12 +101,10 @@ def test_blocking_timeout(self, r):
101101 assert lock1 .acquire (blocking = False )
102102 bt = 0.4
103103 sleep = 0.05
104- fudge_factor = 0.5
105104 lock2 = self .get_lock (r , "foo" , sleep = sleep , blocking_timeout = bt )
106105 start = time .monotonic ()
107106 assert not lock2 .acquire ()
108- # The elapsed duration should be less than the total blocking_timeout
109- assert (bt + fudge_factor ) > (time .monotonic () - start ) > bt - sleep
107+ assert (time .monotonic () - start ) > (bt - sleep )
110108 lock1 .release ()
111109
112110 def test_context_manager (self , r ):
@@ -120,12 +118,10 @@ def test_context_manager_blocking_timeout(self, r):
120118 with self .get_lock (r , "foo" , blocking = False ):
121119 bt = 0.4
122120 sleep = 0.05
123- fudge_factor = 0.5
124121 lock2 = self .get_lock (r , "foo" , sleep = sleep , blocking_timeout = bt )
125122 start = time .monotonic ()
126123 assert not lock2 .acquire ()
127- # The elapsed duration should be less than the total blocking_timeout
128- assert (bt + fudge_factor ) > (time .monotonic () - start ) > bt - sleep
124+ assert (time .monotonic () - start ) > (bt - sleep )
129125
130126 def test_context_manager_raises_when_locked_not_acquired (self , r ):
131127 r .set ("foo" , "bar" )
You can’t perform that action at this time.
0 commit comments