diff options
author | R. David Murray <rdmurray@bitdance.com> | 2010-12-27 00:09:41 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2010-12-27 00:09:41 (GMT) |
commit | 82f58460b2f3ba36ae1b42738d486783865bdd68 (patch) | |
tree | a8b06c59146ba99981ec901bf1160d4bbf15ac7f /Lib/test | |
parent | 5874ed6cee569a73cd0e947605210822b251df7f (diff) | |
download | cpython-82f58460b2f3ba36ae1b42738d486783865bdd68.zip cpython-82f58460b2f3ba36ae1b42738d486783865bdd68.tar.gz cpython-82f58460b2f3ba36ae1b42738d486783865bdd68.tar.bz2 |
Merged revisions 87501 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87501 | r.david.murray | 2010-12-26 19:03:13 -0500 (Sun, 26 Dec 2010) | 2 lines
Escape file path before searching for it in output via regex
........
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_site.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index 0f8405a..4752f09 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -10,6 +10,7 @@ from test.test_support import captured_output import __builtin__ import os import sys +import re import encodings import subprocess import sysconfig @@ -112,7 +113,8 @@ class HelperFunctionsTests(unittest.TestCase): with captured_output("stderr") as err_out: site.addpackage(pth_dir, pth_fn, set()) self.assertRegexpMatches(err_out.getvalue(), "line 1") - self.assertRegexpMatches(err_out.getvalue(), os.path.join(pth_dir, pth_fn)) + self.assertRegexpMatches(err_out.getvalue(), + re.escape(os.path.join(pth_dir, pth_fn))) # XXX: the previous two should be independent checks so that the # order doesn't matter. The next three could be a single check # but my regex foo isn't good enough to write it. @@ -126,7 +128,8 @@ class HelperFunctionsTests(unittest.TestCase): with captured_output("stderr") as err_out: site.addpackage(pth_dir, pth_fn, set()) self.assertRegexpMatches(err_out.getvalue(), "line 2") - self.assertRegexpMatches(err_out.getvalue(), os.path.join(pth_dir, pth_fn)) + self.assertRegexpMatches(err_out.getvalue(), + re.escape(os.path.join(pth_dir, pth_fn))) # XXX: ditto previous XXX comment. self.assertRegexpMatches(err_out.getvalue(), 'Traceback') self.assertRegexpMatches(err_out.getvalue(), 'ImportError') @@ -137,7 +140,8 @@ class HelperFunctionsTests(unittest.TestCase): with captured_output("stderr") as err_out: site.addpackage(pth_dir, pth_fn, set()) self.assertRegexpMatches(err_out.getvalue(), "line 1") - self.assertRegexpMatches(err_out.getvalue(), os.path.join(pth_dir, pth_fn)) + self.assertRegexpMatches(err_out.getvalue(), + re.escape(os.path.join(pth_dir, pth_fn))) # XXX: ditto previous XXX comment. self.assertRegexpMatches(err_out.getvalue(), 'Traceback') self.assertRegexpMatches(err_out.getvalue(), 'TypeError') |