Skip to content

Commit cb19634

Browse files
committed
fix tests
1 parent 6672119 commit cb19634

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

splitio/tasks/util/asynctask.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ def __init__(self, main, period, on_init=None, on_stop=None):
218218
self._period = period
219219
self._messages = asyncio.Queue()
220220
self._running = False
221-
self._task = None
222-
self._stop_event = None
221+
self._completion_event = None
223222

224223
async def _execution_wrapper(self):
225224
"""
@@ -286,7 +285,7 @@ def start(self):
286285
return
287286
# Start execution
288287
self._completion_event = asyncio.Event()
289-
self._task = asyncio.get_running_loop().create_task(self._execution_wrapper())
288+
asyncio.get_running_loop().create_task(self._execution_wrapper())
290289

291290
async def stop(self, wait_for_completion=False):
292291
"""

tests/tasks/util/test_asynctask.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ async def on_stop():
142142
task.start()
143143
await asyncio.sleep(1)
144144
assert task.running()
145-
await task.stop()
145+
await task.stop(True)
146146

147147
assert 0 < self.main_called <= 2
148148
assert self.init_called == 1
@@ -170,7 +170,7 @@ async def on_stop():
170170
task.start()
171171
await asyncio.sleep(1)
172172
assert task.running()
173-
await task.stop()
173+
await task.stop(True)
174174

175175
assert 9 <= self.main_called <= 10
176176
assert self.init_called == 1
@@ -197,7 +197,7 @@ async def on_stop():
197197
task.start()
198198
await asyncio.sleep(0.5)
199199
assert not task.running() # Since on_init fails, task never starts
200-
await task.stop()
200+
await task.stop(True)
201201

202202
assert self.init_called == 1
203203
assert self.stop_called == 1
@@ -223,7 +223,7 @@ async def on_stop():
223223
task = asynctask.AsyncTaskAsync(main_func, 0.1, on_init, on_stop)
224224
task.start()
225225
await asyncio.sleep(1)
226-
await task.stop()
226+
await task.stop(True)
227227
assert 9 <= self.main_called <= 10
228228
assert self.init_called == 1
229229
assert self.stop_called == 1
@@ -249,7 +249,7 @@ async def on_stop():
249249
assert task.running()
250250
task.force_execution()
251251
task.force_execution()
252-
await task.stop()
252+
await task.stop(True)
253253

254254
assert self.main_called == 3
255255
assert self.init_called == 1

0 commit comments

Comments
 (0)