From: Victor Stinner Date: Fri, 27 Jun 2014 22:12:02 +0000 (+0200) Subject: asyncio: Fix unit tests on Windows, escape filenames in regex X-Git-Tag: v3.4.2rc1~296 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b9a301a348f8867f1b8adebd2e6a4d728889f66b;p=thirdparty%2FPython%2Fcpython.git asyncio: Fix unit tests on Windows, escape filenames in regex --- diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index ee872615bc2f..96b41d69db9c 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -322,9 +322,9 @@ class FutureTests(test_utils.TestCase): r'source_traceback: Object created at \(most recent call last\):\n' r' File' r'.*\n' - r' File "%s", line %s, in test_future_exception_never_retrieved\n' + r' File "{filename}", line {lineno}, in test_future_exception_never_retrieved\n' r' future = asyncio\.Future\(loop=self\.loop\)$' - % (frame[0], frame[1])) + ).format(filename=re.escape(frame[0]), lineno=frame[1]) exc_info = (type(exc), exc, exc.__traceback__) m_log.error.assert_called_once_with(mock.ANY, exc_info=exc_info) else: @@ -333,12 +333,12 @@ class FutureTests(test_utils.TestCase): r'Future/Task created at \(most recent call last\):\n' r' File' r'.*\n' - r' File "%s", line %s, in test_future_exception_never_retrieved\n' + r' File "{filename}", line {lineno}, in test_future_exception_never_retrieved\n' r' future = asyncio\.Future\(loop=self\.loop\)\n' r'Traceback \(most recent call last\):\n' r'.*\n' r'MemoryError$' - % (frame[0], frame[1])) + ).format(filename=re.escape(frame[0]), lineno=frame[1]) m_log.error.assert_called_once_with(mock.ANY, exc_info=False) message = m_log.error.call_args[0][0] self.assertRegex(message, re.compile(regex, re.DOTALL)) diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 54b29ba95920..dee14b2e0a5f 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -1602,8 +1602,8 @@ class TaskTests(test_utils.TestCase): r' File "%s", line %s, in test_coroutine_never_yielded\n' r' coro = coro_noop\(\)$' % (re.escape(coro_noop.__qualname__), - func_filename, func_lineno, - tb_filename, tb_lineno)) + re.escape(func_filename), func_lineno, + re.escape(tb_filename), tb_lineno)) self.assertRegex(message, re.compile(regex, re.DOTALL))