Skip to content

Commit

Permalink
(tests) Cancellation needs another yield
Browse files Browse the repository at this point in the history
  • Loading branch information
michalc committed Nov 26, 2018
1 parent 58ab798 commit 9b30018
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ def task(mode):
async def mutate_tasks_in_sequence(task_states, *funcs):
history = []

async def null(_):
pass

for func in funcs + (null, ):
await asyncio.sleep(0)
await asyncio.sleep(0)
Expand All @@ -50,6 +47,10 @@ async def func(tasks):
return func


async def null(_):
pass


def async_test(func):
def wrapper(*args, **kwargs):
future = func(*args, **kwargs)
Expand Down Expand Up @@ -121,7 +122,7 @@ async def test_mutex_cancelled_before_it_starts_allows_later_mutex(self):
started_history = await mutate_tasks_in_sequence(create_lock_tasks(
lock,
Mutex, Mutex, Mutex),
cancel(1), complete(0), complete(2),
cancel(1), complete(0), null, complete(2),
)

self.assertEqual(started_history[0], [True, False, False])
Expand Down

0 comments on commit 9b30018

Please sign in to comment.