[Python-checkins] cpython (2.7): Fix buggy RE “\parrot_example.py”, uncovered by Issue #27030

martin.panter python-checkins at python.org
Sun Jun 12 02:28:43 EDT 2016


https://hg.python.org/cpython/rev/c5411cfa0bd3
changeset:   101922:c5411cfa0bd3
branch:      2.7
parent:      101916:ede10138327e
user:        Martin Panter <vadmium+py at gmail.com>
date:        Sun Jun 12 06:07:35 2016 +0000
summary:
  Fix buggy RE “\parrot_example.py”, uncovered by Issue #27030

files:
  Lib/lib2to3/tests/test_refactor.py |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py
--- a/Lib/lib2to3/tests/test_refactor.py
+++ b/Lib/lib2to3/tests/test_refactor.py
@@ -8,6 +8,7 @@
 import os
 import codecs
 import operator
+import re
 import StringIO
 import tempfile
 import shutil
@@ -226,8 +227,8 @@
                                     actually_write=False)
         # Testing that it logged this message when write=False was passed is
         # sufficient to see that it did not bail early after "No changes".
-        message_regex = r"Not writing changes to .*%s%s" % (
-                os.sep, os.path.basename(test_file))
+        message_regex = r"Not writing changes to .*%s" % \
+                re.escape(os.sep + os.path.basename(test_file))
         for message in debug_messages:
             if "Not writing changes" in message:
                 self.assertRegexpMatches(message, message_regex)

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


More information about the Python-checkins mailing list