Patchwork [5,of,7,hglib] tests: write out bytes instead of strings to test files (issue4520)

login
register
mail settings
Submitter Brett Cannon
Date March 26, 2015, 12:39 a.m.
Message ID <c65b266b8abb6d442740.1427330399@bcannon-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/8282/
State Accepted
Headers show

Comments

Brett Cannon - March 26, 2015, 12:39 a.m.
# HG changeset patch
# User Brett Cannon <brett@python.org>
# Date 1427329421 14400
#      Wed Mar 25 20:23:41 2015 -0400
# Node ID c65b266b8abb6d442740508c08c29dfe8c712ffa
# Parent  5efe91a4c2d49d74d1104edd50cd5a82003df4b6
tests: write out bytes instead of strings to test files (issue4520)
Matt Mackall - March 27, 2015, 12:17 a.m.
On Wed, 2015-03-25 at 20:39 -0400, Brett Cannon wrote:
> # HG changeset patch
> # User Brett Cannon <brett@python.org>
> # Date 1427329421 14400
> #      Wed Mar 25 20:23:41 2015 -0400
> # Node ID c65b266b8abb6d442740508c08c29dfe8c712ffa
> # Parent  5efe91a4c2d49d74d1104edd50cd5a82003df4b6
> tests: write out bytes instead of strings to test files (issue4520)

I've queued 1, 2, 3, and 5 here, thanks. 4 seems to have problems, 6
wants to come after 4, and 7 is doing two things.

Patch

diff -r 5efe91a4c2d4 -r c65b266b8abb tests/common.py
--- a/tests/common.py	Wed Mar 25 20:21:57 2015 -0400
+++ b/tests/common.py	Wed Mar 25 20:23:41 2015 -0400
@@ -45,5 +45,5 @@ 
     def append(self, path, *args):
         f = open(path, 'ab')
         for a in args:
-            f.write(str(a))
+            f.write(a.encode('latin-1'))
         f.close()