tests/test-hgweb-no-path-info.t
changeset 40161 3eea8e83c261
parent 39707 5abc47d4ca6b
child 40203 f80f7a67e176
--- a/tests/test-hgweb-no-path-info.t	Thu Oct 11 22:53:44 2018 +0200
+++ b/tests/test-hgweb-no-path-info.t	Thu Oct 11 23:07:23 2018 +0200
@@ -36,6 +36,7 @@
   >     print('---- HEADERS')
   >     print([i for i in headers if i[0] != 'ETag'])
   >     print('---- DATA')
+  >     sys.stdout.flush()
   >     return output.write
   > 
   > env = {
@@ -55,12 +56,19 @@
   > }
   > 
   > def process(app):
+  >     try:
+  >         stdout = sys.stdout.buffer
+  >     except AttributeError:
+  >         stdout = sys.stdout
   >     content = app(env, startrsp)
-  >     sys.stdout.write(output.getvalue())
-  >     sys.stdout.write(''.join(content))
+  >     stdout.write(output.getvalue())
+  >     stdout.write(b''.join(content))
+  >     stdout.flush()
   >     getattr(content, 'close', lambda : None)()
-  >     print('---- ERRORS')
-  >     print(errors.getvalue())
+  >     if errors.getvalue():
+  >         print('---- ERRORS')
+  >         print(errors.getvalue())
+  >     sys.stdout.flush()
   > 
   > output = stringio()
   > env['QUERY_STRING'] = 'style=atom'
@@ -130,8 +138,6 @@
    </entry>
   
   </feed>
-  ---- ERRORS
-  
   ---- STATUS
   200 Script output follows
   ---- HEADERS
@@ -140,7 +146,5 @@
   
   /repo/
   
-  ---- ERRORS
-  
 
   $ cd ..