summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2009-11-18 11:27:53 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2009-11-18 11:27:53 (GMT)
commit815521fca0c1c353c565be23bdde8c5a19ce24ac (patch)
tree2f3236d61461952aca8a738ba17fe0e43b22c5c1 /Lib
parentacccafcf70dda54fd102c9dbf7c42ae6af7d6b0b (diff)
downloadcpython-815521fca0c1c353c565be23bdde8c5a19ce24ac.zip
cpython-815521fca0c1c353c565be23bdde8c5a19ce24ac.tar.gz
cpython-815521fca0c1c353c565be23bdde8c5a19ce24ac.tar.bz2
Correctly escape arbitrary error message text in the runpy unit tests
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_runpy.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py
index 45c839e..a9cdbee 100644
--- a/Lib/test/test_runpy.py
+++ b/Lib/test/test_runpy.py
@@ -3,6 +3,7 @@ import unittest
import os
import os.path
import sys
+import re
import tempfile
from test.test_support import verbose, run_unittest, forget
from test.script_helper import (temp_dir, make_script, compile_script,
@@ -317,8 +318,7 @@ argv0 = sys.argv[0]
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):