Skip to content

Commit

Permalink
tests: ignore empty message warning in eventstreams.py
Browse files Browse the repository at this point in the history
Bug: T383035
Change-Id: I7fc393df0c868e533b0bf512ef6939b51a70269f
  • Loading branch information
xqt committed Jan 6, 2025
1 parent 489edbc commit edf77b2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pywikibot/comms/eventstreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
.. versionadded:: 3.0
"""
#
# (C) Pywikibot team, 2017-2024
# (C) Pywikibot team, 2017-2025
#
# Distributed under the terms of the MIT license.
#
Expand Down Expand Up @@ -324,7 +324,6 @@ def generator(self):
"""
n = 0
event = None
ignore_first_empty_warning = True
while self._total is None or n < self._total:
if not hasattr(self, 'source'):
self.source = EventSource(**self.sse_kwargs)
Expand Down Expand Up @@ -355,10 +354,7 @@ def generator(self):
if self.streamfilter(element):
n += 1
yield element
elif not ignore_first_empty_warning:
warning('Empty message found.')
else:
ignore_first_empty_warning = False
# else: ignore empty message
elif event.event == 'error':
warning(f'Encountered error: {event.data}')
else:
Expand Down

0 comments on commit edf77b2

Please sign in to comment.