py3: avoid b'' output in test-hgweb-non-interactive.t
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 30 Sep 2018 01:15:46 -0400
changeset 39913 8bd589aecf65
parent 39912 7b35209ba1a7
child 39914 b153ca77a52b
py3: avoid b'' output in test-hgweb-non-interactive.t I couldn't figure out how to get the list to print without b'' with pycompat.write(), without converted each element to str.
tests/test-hgweb-non-interactive.t
--- a/tests/test-hgweb-non-interactive.t	Sun Sep 30 01:10:41 2018 -0400
+++ b/tests/test-hgweb-non-interactive.t	Sun Sep 30 01:15:46 2018 -0400
@@ -12,7 +12,9 @@
   > import sys
   > from mercurial import (
   >     dispatch,
+  >     encoding,
   >     hg,
+  >     pycompat,
   >     ui as uimod,
   >     util,
   > )
@@ -68,13 +70,15 @@
   > i = hgweb(b'.')
   > for c in i(env, startrsp):
   >     pass
-  > print('---- ERRORS')
-  > print(errors.getvalue())
+  > sys.stdout.flush()
+  > pycompat.stdout.write(b'---- ERRORS\n')
+  > pycompat.stdout.write(b'%s\n' % errors.getvalue())
   > print('---- OS.ENVIRON wsgi variables')
   > print(sorted([x for x in os.environ if x.startswith('wsgi')]))
   > print('---- request.ENVIRON wsgi variables')
   > with i._obtainrepo() as repo:
-  >     print(sorted([x for x in repo.ui.environ if x.startswith(b'wsgi')]))
+  >     print(sorted([encoding.strfromlocal(x) for x in repo.ui.environ
+  >                   if x.startswith(b'wsgi')]))
   > EOF
   $ "$PYTHON" request.py
   ---- STATUS