[Python-checkins] r76364 - in python/branches/py3k: Lib/test/test_runpy.py

nick.coghlan python-checkins at python.org
Wed Nov 18 12:35:25 CET 2009


Author: nick.coghlan
Date: Wed Nov 18 12:35:25 2009
New Revision: 76364

Log:
Merged revisions 76362 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76362 | nick.coghlan | 2009-11-18 21:27:53 +1000 (Wed, 18 Nov 2009) | 1 line
  
  Correctly escape arbitrary error message text in the runpy unit tests
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/test/test_runpy.py

Modified: python/branches/py3k/Lib/test/test_runpy.py
==============================================================================
--- python/branches/py3k/Lib/test/test_runpy.py	(original)
+++ python/branches/py3k/Lib/test/test_runpy.py	Wed Nov 18 12:35:25 2009
@@ -3,6 +3,7 @@
 import os
 import os.path
 import sys
+import re
 import tempfile
 from test.support import verbose, run_unittest, forget
 from test.script_helper import (temp_dir, make_script, compile_script,
@@ -290,8 +291,7 @@
         self.assertEqual(result["__package__"], expected_package)
 
     def _check_import_error(self, script_name, msg):
-        # Double backslashes to handle path separators on Windows
-        msg = msg.replace("\\", "\\\\")
+        msg = re.escape(msg)
         self.assertRaisesRegexp(ImportError, msg, run_path, script_name)
 
     def test_basic_script(self):


More information about the Python-checkins mailing list