diff options
author | Allan Crooks <allan@amcone.net> | 2014-04-16 14:25:24 -0400 |
---|---|---|
committer | Allan Crooks <allan@amcone.net> | 2014-04-16 14:25:24 -0400 |
commit | 601ec96fc62f190a1d802596119aefb95fb70e51 (patch) | |
tree | 447a58ee92aaef0a17759c63804d5dc4748d8fe7 /cherrypy/test/helper.py | |
parent | 68c3cc406c6cb1a46a8ef45a445ea717caf8ba8f (diff) | |
download | cherrypy-git-601ec96fc62f190a1d802596119aefb95fb70e51.tar.gz |
Fix for recent commits which were causing a number of tests to fail in Python 3.
Diffstat (limited to 'cherrypy/test/helper.py')
-rw-r--r-- | cherrypy/test/helper.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cherrypy/test/helper.py b/cherrypy/test/helper.py index a76abce3..b6ed3277 100644 --- a/cherrypy/test/helper.py +++ b/cherrypy/test/helper.py @@ -365,12 +365,13 @@ class CPWebCase(webtest.WebCase): # First, test the response body without checking the traceback. # Stick a match-all group (.*) in to grab the traceback. - esc = re.escape - epage = esc(page) + def esc(text): + return re.escape(ntob(text)) + epage = re.escape(page) epage = epage.replace( esc('<pre id="traceback"></pre>'), - esc('<pre id="traceback">') + '(.*)' + esc('</pre>')) - m = re.match(ntob(epage, self.encoding), self.body, re.DOTALL) + esc('<pre id="traceback">') + ntob('(.*)') + esc('</pre>')) + m = re.match(epage, self.body, re.DOTALL) if not m: self._handlewebError( 'Error page does not match; expected:\n' + page) |