Skip to content

Commit

Permalink
Merge pull request #3465 from jsiirola/buffer-test-retry
Browse files Browse the repository at this point in the history
Address intermittent TeeStream test failure
  • Loading branch information
blnicho authored Feb 5, 2025
2 parents 61e28af + 83eb7d7 commit cd778c5
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions pyomo/common/tests/test_tee.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def test_buffered_stdout(self):
if not ts.check(*baseline):
self.fail(ts.error)

def test_buffered_stdout_flush(self):
def test_buffered_stdout_flush(self, retry=True):
# Test 2: short messages to STDOUT that are flushed are flushed
fd = self.capture_fd
ts = timestamper()
Expand All @@ -345,9 +345,18 @@ def test_buffered_stdout_flush(self):
time.sleep(self.dt)
ts.write(f"{time.time()}\n")
if not ts.check([(0, 0), (0, 0), (0, 0), (1, 1)]):
# TODO: For some reason, some part of the flush logic is not
# reliable under pypy.
if not platform.python_implementation().lower().startswith('pypy'):
# FIXME: We don't know why, but this test will
# intermittently fail. For the moment, we will just wait a
# little and give it a second chance with a longer delay.
if retry:
time.sleep(self.dt)
self.dt *= 2.5
self.test_buffered_stdout_flush(False)
elif platform.python_implementation().lower().startswith('pypy'):
# TODO: For some reason, some part of the flush logic is
# not reliable under pypy.
pass
else:
self.fail(ts.error)

def test_buffered_stdout_long_message(self):
Expand Down

0 comments on commit cd778c5

Please sign in to comment.