Commit 3fa68ea7 authored by R. David Murray's avatar R. David Murray

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
........
parent a7d0a2ec
...@@ -10,6 +10,7 @@ from test.support import captured_output ...@@ -10,6 +10,7 @@ from test.support import captured_output
import builtins import builtins
import os import os
import sys import sys
import re
import encodings import encodings
import subprocess import subprocess
# Need to make sure to not import 'site' if someone specified ``-S`` at the # Need to make sure to not import 'site' if someone specified ``-S`` at the
...@@ -101,7 +102,8 @@ class HelperFunctionsTests(unittest.TestCase): ...@@ -101,7 +102,8 @@ class HelperFunctionsTests(unittest.TestCase):
with captured_output("stderr") as err_out: with captured_output("stderr") as err_out:
site.addpackage(pth_dir, pth_fn, set()) site.addpackage(pth_dir, pth_fn, set())
self.assertRegexpMatches(err_out.getvalue(), "line 1") 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 # XXX: the previous two should be independent checks so that the
# order doesn't matter. The next three could be a single check # order doesn't matter. The next three could be a single check
# but my regex foo isn't good enough to write it. # but my regex foo isn't good enough to write it.
...@@ -115,7 +117,8 @@ class HelperFunctionsTests(unittest.TestCase): ...@@ -115,7 +117,8 @@ class HelperFunctionsTests(unittest.TestCase):
with captured_output("stderr") as err_out: with captured_output("stderr") as err_out:
site.addpackage(pth_dir, pth_fn, set()) site.addpackage(pth_dir, pth_fn, set())
self.assertRegexpMatches(err_out.getvalue(), "line 2") 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. # XXX: ditto previous XXX comment.
self.assertRegexpMatches(err_out.getvalue(), 'Traceback') self.assertRegexpMatches(err_out.getvalue(), 'Traceback')
self.assertRegexpMatches(err_out.getvalue(), 'ImportError') self.assertRegexpMatches(err_out.getvalue(), 'ImportError')
...@@ -126,7 +129,8 @@ class HelperFunctionsTests(unittest.TestCase): ...@@ -126,7 +129,8 @@ class HelperFunctionsTests(unittest.TestCase):
with captured_output("stderr") as err_out: with captured_output("stderr") as err_out:
site.addpackage(pth_dir, pth_fn, set()) site.addpackage(pth_dir, pth_fn, set())
self.assertRegexpMatches(err_out.getvalue(), "line 1") 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. # XXX: ditto previous XXX comment.
self.assertRegexpMatches(err_out.getvalue(), 'Traceback') self.assertRegexpMatches(err_out.getvalue(), 'Traceback')
self.assertRegexpMatches(err_out.getvalue(), 'TypeError') self.assertRegexpMatches(err_out.getvalue(), 'TypeError')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment