Skip to content

Commit

Permalink
fix: increase total events also when using sync testing
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosschroh committed Nov 22, 2023
1 parent 28a377d commit be6ead1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions kstreams/test_utils/topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ class Topic:

async def put(self, event: ConsumerRecord) -> None:
await self.queue.put(event)

# keep track of the amount of events per topic partition
self.total_partition_events[event.partition] += 1
self.total_events += 1
self._inc_amount(event)

async def get(self) -> ConsumerRecord:
return await self.queue.get()
Expand All @@ -33,7 +30,13 @@ def get_nowait(self) -> ConsumerRecord:
return self.queue.get_nowait()

def put_nowait(self, *, event: ConsumerRecord) -> None:
return self.queue.put_nowait(event)
self.queue.put_nowait(event)
self._inc_amount(event)

Check warning on line 34 in kstreams/test_utils/topics.py

View check run for this annotation

Codecov / codecov/patch

kstreams/test_utils/topics.py#L33-L34

Added lines #L33 - L34 were not covered by tests

def _inc_amount(self, event: ConsumerRecord) -> None:
# keep track of the amount of events per topic partition
self.total_partition_events[event.partition] += 1
self.total_events += 1

def task_done(self) -> None:
self.queue.task_done()
Expand Down

0 comments on commit be6ead1

Please sign in to comment.