[Python-checkins] cpython (merge 3.4 -> default): (Merge 3.4) asyncio: Fix unit tests on Windows, escape filenames in regex

victor.stinner python-checkins at python.org
Sat Jun 28 00:14:37 CEST 2014


http://hg.python.org/cpython/rev/d7f108ebc2dd
changeset: 91453:d7f108ebc2dd
parent: 91451:7c9335d97628
parent: 91452:26287c059304
user: Victor Stinner <victor.stinner at gmail.com>
date: Sat Jun 28 00:14:28 2014 +0200
summary:
 (Merge 3.4) asyncio: Fix unit tests on Windows, escape filenames in regex
files:
 Lib/test/test_asyncio/test_futures.py | 8 ++++----
 Lib/test/test_asyncio/test_tasks.py | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py
--- a/Lib/test/test_asyncio/test_futures.py
+++ b/Lib/test/test_asyncio/test_futures.py
@@ -322,9 +322,9 @@
 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 @@
 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
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -1602,8 +1602,8 @@
 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))
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /