Skip to content

Commit

Permalink
Extend event test to check content of WorkerEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoliaw committed May 24, 2023
1 parent 89bb6b3 commit bf256e9
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/worker/test_reworker.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,15 @@ def assert_running_count_plan_produces_ordered_worker_and_data_events(
lambda _: next(count) >= len(expected_events) - 1,
)

worker.submit_task("test_count", task)
worker.submit_task("count", task)
results = events.result(timeout=timeout)

data_events = (event for event in expected_events if isinstance(event, DataEvent))

for i in range(len(expected_events)):
assert isinstance(results[i], type(expected_events[i]))

if isinstance(results[i], type(DataEvent)):
data_event_name = next(data_events)
assert data_event_name == getattr(results[i], "name")
for actual, expected in itertools.zip_longest(results, expected_events):
if isinstance(expected, WorkerEvent):
assert actual == expected
elif isinstance(expected, DataEvent):
assert isinstance(actual, DataEvent)
assert actual.name == expected.name


E = TypeVar("E")
Expand Down

0 comments on commit bf256e9

Please sign in to comment.