Skip to content

Commit

Permalink
Remove event_loop fixture, as suggested by pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
gerzse committed Jul 4, 2024
1 parent 1634946 commit fcd9670
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_asyncio/test_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ async def test_blocking(self, r):
lock_2 = self.get_lock(r, "foo")
assert lock_2.blocking

async def test_blocking_timeout(self, r, event_loop):
async def test_blocking_timeout(self, r):
lock1 = self.get_lock(r, "foo")
assert await lock1.acquire(blocking=False)
bt = 0.2
sleep = 0.05
lock2 = self.get_lock(r, "foo", sleep=sleep, blocking_timeout=bt)
start = event_loop.time()
start = asyncio.get_running_loop().time()
assert not await lock2.acquire()
# The elapsed duration should be less than the total blocking_timeout
assert bt >= (event_loop.time() - start) > bt - sleep
assert bt >= (asyncio.get_running_loop().time() - start) > bt - sleep
await lock1.release()

async def test_context_manager(self, r):
Expand Down

0 comments on commit fcd9670

Please sign in to comment.