Patchwork [1,of,6] run-tests: flush output stream before prompting to accept changes

login
register
mail settings
Submitter Matt Harbison
Date Sept. 30, 2018, 5:46 a.m.
Message ID <32349019b1ed3beae780.1538286380@Envy>
Download mbox | patch
Permalink /patch/35211/
State Accepted
Headers show

Comments

Matt Harbison - Sept. 30, 2018, 5:46 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1538267632 14400
#      Sat Sep 29 20:33:52 2018 -0400
# Node ID 32349019b1ed3beae780cfe4c628d71714c6f675
# Parent  7eb937f598d1c7b79502a62e674bd667d398e2ef
run-tests: flush output stream before prompting to accept changes

With py3 on Windows, the prompt to accept changes in an --interactive run wasn't
showing up until after the choice was read from stdin.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1875,6 +1875,7 @@  class TestResult(unittest._TextTestResul
                         'changes)')
                 else:
                     self.stream.write('Accept this change? [n] ')
+                    self.stream.flush()
                     answer = sys.stdin.readline().strip()
                     if answer.lower() in ('y', 'yes'):
                         if test.path.endswith(b'.t'):