Skip to content

Commit 3ccd061

Browse files
Update test/asynchronous/test_periodic_executor.py
Co-authored-by: Noah Stapp <noah@noahstapp.com>
1 parent 7506d67 commit 3ccd061

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

test/asynchronous/test_periodic_executor.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,11 @@ async def test_wake_causes_early_run(self):
146146
woken = asyncio.Event()
147147

148148
async def target():
149-
call_count[0] += 1
150-
if call_count[0] == 1:
149+
nonlocal call_count
150+
call_count += 1
151+
if call_count == 1:
151152
woken.set()
152-
if call_count[0] >= 2:
153-
return False
154-
return True
153+
return call_count < 2
155154

156155
self.executor = _make_executor(interval=30.0, min_interval=0.01, target=target)
157156
self.executor.open()
@@ -161,7 +160,7 @@ async def target():
161160
await asyncio.wait_for(woken.wait(), timeout=2)
162161
self.executor.wake()
163162
await self.executor.join(timeout=3)
164-
self.assertGreaterEqual(call_count[0], 2)
163+
self.assertGreaterEqual(call_count, 2)
165164

166165
async def test_open_after_target_returns_false(self):
167166
called = [0]

0 commit comments

Comments
 (0)