]> granicus.if.org Git - python/commitdiff
re.escape os.sep so that \ is interpreted properly in the regex.
authorGregory P. Smith <greg@krypto.org>
Tue, 14 Feb 2012 00:45:47 +0000 (16:45 -0800)
committerGregory P. Smith <greg@krypto.org>
Tue, 14 Feb 2012 00:45:47 +0000 (16:45 -0800)
Lib/lib2to3/tests/test_main.py

index 455d8a73670cbc4ce9ae0f6e1a81eb1e4c7370b2..7f8b25ca70e9c94f8d29da80350f459b7e4deb3b 100644 (file)
@@ -3,6 +3,7 @@ import sys
 import codecs
 import logging
 import os
+import re
 import shutil
 import StringIO
 import sys
@@ -104,10 +105,11 @@ class TestMain(unittest.TestCase):
             self.assertIn("Writing converted %s to %s" % (
                     os.path.join(self.py2_src_dir, name),
                     os.path.join(self.py3_dest_dir, name+suffix)), stderr)
+        sep = re.escape(os.sep)
         self.assertRegexpMatches(
-                stderr, r"No changes to .*/__init__\.py".replace("/", os.sep))
+                stderr, r"No changes to .*/__init__\.py".replace("/", sep))
         self.assertNotRegex(
-                stderr, r"No changes to .*/trivial\.py".replace("/", os.sep))
+                stderr, r"No changes to .*/trivial\.py".replace("/", sep))
 
     def test_filename_changing_on_output_two_files(self):
         """2to3 two files in one directory with a new output dir."""