[Python-checkins] cpython: Fix test_gzip failures on Windows.

nadeem.vawda python-checkins at python.org
Sun May 6 16:26:01 CEST 2012


http://hg.python.org/cpython/rev/f52df8fd3235
changeset:   76798:f52df8fd3235
user:        Nadeem Vawda <nadeem.vawda at gmail.com>
date:        Sun May 06 16:25:35 2012 +0200
summary:
  Fix test_gzip failures on Windows.

files:
  Lib/test/test_gzip.py |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -409,7 +409,7 @@
             self.assertEqual(file_data, uncompressed * 2)
 
     def test_text_modes(self):
-        uncompressed = data1.decode("ascii") * 50
+        uncompressed = data1.decode("ascii").replace("\n", os.linesep) * 50
         with gzip.open(self.filename, "wt") as f:
             f.write(uncompressed)
         with open(self.filename, "rb") as f:
@@ -436,7 +436,7 @@
 
     def test_encoding(self):
         # Test non-default encoding.
-        uncompressed = data1.decode("ascii") * 50
+        uncompressed = data1.decode("ascii").replace("\n", os.linesep) * 50
         with gzip.open(self.filename, "wt", encoding="utf-16") as f:
             f.write(uncompressed)
         with open(self.filename, "rb") as f:
@@ -456,7 +456,7 @@
     def test_newline(self):
         # Test with explicit newline (universal newline mode disabled).
         uncompressed = data1.decode("ascii") * 50
-        with gzip.open(self.filename, "wt") as f:
+        with gzip.open(self.filename, "wt", newline="\n") as f:
             f.write(uncompressed)
         with gzip.open(self.filename, "rt", newline="\r") as f:
             self.assertEqual(f.readlines(), [uncompressed])

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list