Submitter | Matt Harbison |
---|---|
Date | Sept. 28, 2018, 4:38 a.m. |
Message ID | <777d233b5174c0ca9789.1538109539@Envy> |
Download | mbox | patch |
Permalink | /patch/35157/ |
State | Accepted |
Headers | show |
Comments
On Fri, 28 Sep 2018 00:38:59 -0400, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison <matt_harbison@yahoo.com> > # Date 1538100432 14400 > # Thu Sep 27 22:07:12 2018 -0400 > # Node ID 777d233b5174c0ca9789080b52225247eb36bdec > # Parent 591764c38fedebc1bd32d5454603888ca57c1656 > py3: ensure printing to stdout uses str in test-hgweb-no-request-uri.t Queued, thanks. > @@ -55,11 +56,11 @@ should be used from d74fc8dec2b4 onward > > > > def process(app): > > content = app(env, startrsp) > - > sys.stdout.write(output.getvalue()) > - > sys.stdout.write(''.join(content)) > + > sys.stdout.write(encoding.strfromlocal(output.getvalue())) > + > sys.stdout.write(encoding.strfromlocal(b''.join(content))) It's probably better to write directly to the underlying bytes stream (i.e. sys.stdout.buffer), but I don't care as this is a test code.
Patch
diff --git a/tests/test-hgweb-no-request-uri.t b/tests/test-hgweb-no-request-uri.t --- a/tests/test-hgweb-no-request-uri.t +++ b/tests/test-hgweb-no-request-uri.t @@ -23,6 +23,7 @@ should be used from d74fc8dec2b4 onward > hgwebdir, > ) > from mercurial import ( + > encoding, > util, > ) > stringio = util.stringio @@ -55,11 +56,11 @@ should be used from d74fc8dec2b4 onward > > def process(app): > content = app(env, startrsp) - > sys.stdout.write(output.getvalue()) - > sys.stdout.write(''.join(content)) + > sys.stdout.write(encoding.strfromlocal(output.getvalue())) + > sys.stdout.write(encoding.strfromlocal(b''.join(content))) > getattr(content, 'close', lambda : None)() > print('---- ERRORS') - > print(errors.getvalue()) + > print(encoding.strfromlocal(errors.getvalue())) # avoid b'' output diff > > output = stringio() > env['PATH_INFO'] = '/'