summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-09 00:02:52 +0100
committerVictor Stinner <victor.stinner@gmail.com>2015-01-09 00:02:52 +0100
commit9d4323861f0e3a69018f0b7ad00a99b0e6663835 (patch)
treeeaba0f6409b8719642f7f6419d6000502a44e67d /tests
parentf139962e14cf85658af3b563adbeb7fbde07c864 (diff)
downloadtrollius-git-9d4323861f0e3a69018f0b7ad00a99b0e6663835.tar.gz
Truncate to 80 columns
Diffstat (limited to 'tests')
-rw-r--r--tests/test_base_events.py9
-rw-r--r--tests/test_futures.py24
-rw-r--r--tests/test_streams.py6
-rw-r--r--tests/test_subprocess.py4
-rw-r--r--tests/test_tasks.py12
5 files changed, 37 insertions, 18 deletions
diff --git a/tests/test_base_events.py b/tests/test_base_events.py
index 6599e4e..6bf7e79 100644
--- a/tests/test_base_events.py
+++ b/tests/test_base_events.py
@@ -285,7 +285,8 @@ class BaseEventLoopTests(test_utils.TestCase):
@mock.patch('asyncio.base_events.logger')
def test__run_once_logging(self, m_logger):
def slow_select(timeout):
- # Sleep a bit longer than a second to avoid timer resolution issues.
+ # Sleep a bit longer than a second to avoid timer resolution
+ # issues.
time.sleep(1.1)
return []
@@ -1217,14 +1218,16 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
self.loop.run_forever()
fmt, *args = m_logger.warning.call_args[0]
self.assertRegex(fmt % tuple(args),
- "^Executing <Handle.*stop_loop_cb.*> took .* seconds$")
+ "^Executing <Handle.*stop_loop_cb.*> "
+ "took .* seconds$")
# slow task
asyncio.async(stop_loop_coro(self.loop), loop=self.loop)
self.loop.run_forever()
fmt, *args = m_logger.warning.call_args[0]
self.assertRegex(fmt % tuple(args),
- "^Executing <Task.*stop_loop_coro.*> took .* seconds$")
+ "^Executing <Task.*stop_loop_coro.*> "
+ "took .* seconds$")
if __name__ == '__main__':
diff --git a/tests/test_futures.py b/tests/test_futures.py
index 2863709..dac1e89 100644
--- a/tests/test_futures.py
+++ b/tests/test_futures.py
@@ -133,7 +133,8 @@ class FutureTests(test_utils.TestCase):
exc = RuntimeError()
f_exception = asyncio.Future(loop=self.loop)
f_exception.set_exception(exc)
- self.assertEqual(repr(f_exception), '<Future finished exception=RuntimeError()>')
+ self.assertEqual(repr(f_exception),
+ '<Future finished exception=RuntimeError()>')
self.assertIs(f_exception.exception(), exc)
def func_repr(func):
@@ -332,16 +333,21 @@ class FutureTests(test_utils.TestCase):
if debug:
frame = source_traceback[-1]
regex = (r'^Future exception was never retrieved\n'
- r'future: <Future finished exception=MemoryError\(\) created at {filename}:{lineno}>\n'
- r'source_traceback: Object created at \(most recent call last\):\n'
+ r'future: <Future finished exception=MemoryError\(\) '
+ r'created at {filename}:{lineno}>\n'
+ r'source_traceback: Object '
+ r'created at \(most recent call last\):\n'
r' File'
r'.*\n'
- r' File "{filename}", line {lineno}, in check_future_exception_never_retrieved\n'
+ r' File "{filename}", line {lineno}, '
+ r'in check_future_exception_never_retrieved\n'
r' future = asyncio\.Future\(loop=self\.loop\)$'
- ).format(filename=re.escape(frame[0]), lineno=frame[1])
+ ).format(filename=re.escape(frame[0]),
+ lineno=frame[1])
else:
regex = (r'^Future exception was never retrieved\n'
- r'future: <Future finished exception=MemoryError\(\)>$'
+ r'future: '
+ r'<Future finished exception=MemoryError\(\)>$'
)
exc_info = (type(exc), exc, exc.__traceback__)
m_log.error.assert_called_once_with(mock.ANY, exc_info=exc_info)
@@ -352,12 +358,14 @@ class FutureTests(test_utils.TestCase):
r'Future/Task created at \(most recent call last\):\n'
r' File'
r'.*\n'
- r' File "{filename}", line {lineno}, in check_future_exception_never_retrieved\n'
+ r' File "{filename}", line {lineno}, '
+ r'in check_future_exception_never_retrieved\n'
r' future = asyncio\.Future\(loop=self\.loop\)\n'
r'Traceback \(most recent call last\):\n'
r'.*\n'
r'MemoryError$'
- ).format(filename=re.escape(frame[0]), lineno=frame[1])
+ ).format(filename=re.escape(frame[0]),
+ lineno=frame[1])
else:
regex = (r'^Future/Task exception was never retrieved\n'
r'Traceback \(most recent call last\):\n'
diff --git a/tests/test_streams.py b/tests/test_streams.py
index 73a375a..05963cf 100644
--- a/tests/test_streams.py
+++ b/tests/test_streams.py
@@ -613,8 +613,10 @@ os.close(fd)
watcher.attach_loop(self.loop)
try:
asyncio.set_child_watcher(watcher)
- proc = self.loop.run_until_complete(
- asyncio.create_subprocess_exec(*args, pass_fds={wfd}, loop=self.loop))
+ create = asyncio.create_subprocess_exec(*args,
+ pass_fds={wfd},
+ loop=self.loop)
+ proc = self.loop.run_until_complete(create)
self.loop.run_until_complete(proc.wait())
finally:
asyncio.set_child_watcher(None)
diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py
index 1fe9095..5fc1dc0 100644
--- a/tests/test_subprocess.py
+++ b/tests/test_subprocess.py
@@ -115,7 +115,9 @@ class SubprocessMixin:
def test_send_signal(self):
code = 'import time; print("sleeping", flush=True); time.sleep(3600)'
args = [sys.executable, '-c', code]
- create = asyncio.create_subprocess_exec(*args, loop=self.loop, stdout=subprocess.PIPE)
+ create = asyncio.create_subprocess_exec(*args,
+ stdout=subprocess.PIPE,
+ loop=self.loop)
proc = self.loop.run_until_complete(create)
@asyncio.coroutine
diff --git a/tests/test_tasks.py b/tests/test_tasks.py
index 1520fb4..7807dc0 100644
--- a/tests/test_tasks.py
+++ b/tests/test_tasks.py
@@ -208,7 +208,8 @@ class TaskTests(test_utils.TestCase):
self.assertEqual(notmuch.__name__, 'notmuch')
if PY35:
self.assertEqual(notmuch.__qualname__,
- 'TaskTests.test_task_repr_coro_decorator.<locals>.notmuch')
+ 'TaskTests.test_task_repr_coro_decorator'
+ '.<locals>.notmuch')
self.assertEqual(notmuch.__module__, __name__)
# test coroutine object
@@ -218,7 +219,8 @@ class TaskTests(test_utils.TestCase):
# function, as expected, and have a qualified name (__qualname__
# attribute).
coro_name = 'notmuch'
- coro_qualname = 'TaskTests.test_task_repr_coro_decorator.<locals>.notmuch'
+ coro_qualname = ('TaskTests.test_task_repr_coro_decorator'
+ '.<locals>.notmuch')
else:
# On Python < 3.5, generators inherit the name of the code, not of
# the function. See: http://bugs.python.org/issue21205
@@ -239,7 +241,8 @@ class TaskTests(test_utils.TestCase):
else:
code = gen.gi_code
coro = ('%s() running at %s:%s'
- % (coro_qualname, code.co_filename, code.co_firstlineno))
+ % (coro_qualname, code.co_filename,
+ code.co_firstlineno))
self.assertEqual(repr(gen), '<CoroWrapper %s>' % coro)
@@ -1678,7 +1681,8 @@ class TaskTests(test_utils.TestCase):
self.assertTrue(m_log.error.called)
message = m_log.error.call_args[0][0]
func_filename, func_lineno = test_utils.get_function_source(coro_noop)
- regex = (r'^<CoroWrapper %s\(\) .* at %s:%s, .*> was never yielded from\n'
+ regex = (r'^<CoroWrapper %s\(\) .* at %s:%s, .*> '
+ r'was never yielded from\n'
r'Coroutine object created at \(most recent call last\):\n'
r'.*\n'
r' File "%s", line %s, in test_coroutine_never_yielded\n'