py3: flush std streams before/after running user code in heredoctest.py
Otherwise, things written to stdout.buffer would be interleaved.
--- a/tests/heredoctest.py Tue Oct 16 08:06:17 2018 +0200
+++ b/tests/heredoctest.py Tue Oct 16 07:18:30 2018 +0200
@@ -2,6 +2,10 @@
import sys
+def flush():
+ sys.stdout.flush()
+ sys.stderr.flush()
+
globalvars = {}
lines = sys.stdin.readlines()
while lines:
@@ -15,6 +19,9 @@
snippet += l[4:]
c = compile(snippet, '<heredoc>', 'single')
try:
+ flush()
exec(c, globalvars)
+ flush()
except Exception as inst:
+ flush()
print(repr(inst))