From: Martin Panter Date: Sun, 12 Jun 2016 06:07:35 +0000 (+0000) Subject: Fix buggy RE “\parrot_example.py”, uncovered by Issue #27030 X-Git-Tag: v3.6.0a2~26^2~2^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d4704803b95efea847cd0a9065818d771c9941fb;p=thirdparty%2FPython%2Fcpython.git Fix buggy RE “\parrot_example.py”, uncovered by Issue #27030 --- diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py index f30c1e863095..856300153ddc 100644 --- a/Lib/lib2to3/tests/test_refactor.py +++ b/Lib/lib2to3/tests/test_refactor.py @@ -9,6 +9,7 @@ import os import codecs import operator import io +import re import tempfile import shutil import unittest @@ -226,8 +227,8 @@ from __future__ import print_function""" 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.assertRegex(message, message_regex)