[Python-checkins] cpython (merge 3.2 -> default): - Re-enable lib2to3's test_parser.py tests, though with an expected failure

barry.warsaw python-checkins at python.org
Fri Oct 7 21:27:08 CEST 2011


http://hg.python.org/cpython/rev/ed0315b9da72
changeset:   72806:ed0315b9da72
parent:      72804:075d7ed8d840
parent:      72805:1d71bc14113f
user:        Barry Warsaw <barry at python.org>
date:        Fri Oct 07 15:26:54 2011 -0400
summary:
  - Re-enable lib2to3's test_parser.py tests, though with an expected failure
  (see issue 13125).

files:
  Lib/lib2to3/tests/test_parser.py |  4 +---
  Lib/test/test_lib2to3.py         |  2 +-
  2 files changed, 2 insertions(+), 4 deletions(-)


diff --git a/Lib/lib2to3/tests/test_parser.py b/Lib/lib2to3/tests/test_parser.py
--- a/Lib/lib2to3/tests/test_parser.py
+++ b/Lib/lib2to3/tests/test_parser.py
@@ -166,7 +166,7 @@
                 encoding = tokenize.detect_encoding(fp.readline)[0]
             self.assertTrue(encoding is not None,
                             "can't detect encoding for %s" % filepath)
-            with open(filepath, "r") as fp:
+            with open(filepath, "r", encoding=encoding) as fp:
                 source = fp.read()
             try:
                 tree = driver.parse_string(source)
@@ -174,8 +174,6 @@
                 print('ParseError on file', filepath, err)
                 continue
             new = str(tree)
-            if encoding:
-                new = new.encode(encoding)
             if diff(filepath, new):
                 self.fail("Idempotency failed: %s" % filepath)
 
diff --git a/Lib/test/test_lib2to3.py b/Lib/test/test_lib2to3.py
--- a/Lib/test/test_lib2to3.py
+++ b/Lib/test/test_lib2to3.py
@@ -9,7 +9,7 @@
 def suite():
     tests = unittest.TestSuite()
     loader = unittest.TestLoader()
-    for m in (test_fixers, test_pytree,test_util, test_refactor, test_parser,
+    for m in (test_fixers, test_pytree, test_util, test_refactor, test_parser,
               test_main_):
         tests.addTests(loader.loadTestsFromModule(m))
     return tests

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


More information about the Python-checkins mailing list