Skip to content

Commit

Permalink
up to asyncio loop
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-usielski committed Dec 2, 2024
1 parent 15238cf commit ea16b9f
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions test/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,7 @@ def test_asyncio_test_job():
try:
loop = asyncio.get_running_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
was_loop_created = True

return # No working asyncio
Scheduler.change_kind("asyncio")
values = {'number': 0}
job = Scheduler.get_job(callback=callback, interval=0.1, callback_params={'param_dict': values})
Expand All @@ -112,13 +109,7 @@ def test_asyncio_test_job():
job.cancel()
loop.stop()
Scheduler.change_kind() # Set the default
try:
assert (2 == values['number'])
finally:
if was_loop_created:
loop.stop()
loop.close()

assert (2 == values['number'])


def test_cannot_create_more_objects():
Expand Down

0 comments on commit ea16b9f

Please sign in to comment.