D4972: py3: tweak stdout writing in test-hgweb-no-path-info.t

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Oct 12 06:47:52 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3eea8e83c261: py3: tweak stdout writing in test-hgweb-no-path-info.t (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4972?vs=11838&id=11861

REVISION DETAIL
  https://phab.mercurial-scm.org/D4972

AFFECTED FILES
  tests/test-hgweb-no-path-info.t

CHANGE DETAILS

diff --git a/tests/test-hgweb-no-path-info.t b/tests/test-hgweb-no-path-info.t
--- a/tests/test-hgweb-no-path-info.t
+++ b/tests/test-hgweb-no-path-info.t
@@ -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,17 +138,13 @@
    </entry>
   
   </feed>
-  ---- ERRORS
-  
   ---- STATUS
   200 Script output follows
   ---- HEADERS
   [('Content-Type', 'text/plain; charset=ascii')]
   ---- DATA
   
   /repo/
   
-  ---- ERRORS
-  
 
   $ cd ..



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list