Skip to content

Commit

Permalink
Change the way to run async function
Browse files Browse the repository at this point in the history
  • Loading branch information
affjljoo3581 committed Jul 6, 2020
1 parent 4842836 commit de8efd4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ async def test_fn(i):
return i

ctx = Context(max_tasks=10)
result, errors = asyncio.run(ctx.run(test_fn(i) for i in range(100)))

loop = asyncio.get_event_loop()
result, errors = loop.run_until_complete(
ctx.run(test_fn(i) for i in range(100)))

assert errors == 0
assert set(result) == set(range(100))
Expand Down

0 comments on commit de8efd4

Please sign in to comment.