blob: 6cdddefd503fcf283d3dae588f1032540f3863d5 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
Do not fail test on runtime warning like: RuntimeWarning: coroutine 'noop2' was
never awaited. This could be related to
https://github.com/aio-libs/aiohttp/commit/60f01cca36b9f9d8d35dd351384eaae2f8fd0d4b,
which does not fix this issue though.
--- a/aiohttp/pytest_plugin.py 2019-10-09 18:52:31.000000000 +0200
+++ b/aiohttp/pytest_plugin.py 2020-03-05 08:35:48.230396025 +0100
@@ -120,15 +120,6 @@
"""
with warnings.catch_warnings(record=True) as _warnings:
yield
- rw = ['{w.filename}:{w.lineno}:{w.message}'.format(w=w)
- for w in _warnings # type: ignore
- if w.category == RuntimeWarning]
- if rw:
- raise RuntimeError('{} Runtime Warning{},\n{}'.format(
- len(rw),
- '' if len(rw) == 1 else 's',
- '\n'.join(rw)
- ))
@contextlib.contextmanager
--- a/tests/test_pytest_plugin.py 2020-03-05 09:26:58.502284893 +0100
+++ a/tests/test_pytest_plugin.py 2020-03-05 09:27:06.074284619 +0100
@@ -170,7 +170,7 @@
expected_outcomes = (
{'failed': 0, 'passed': 2}
if IS_PYPY and bool(os.environ.get('PYTHONASYNCIODEBUG'))
- else {'failed': 1, 'passed': 1}
+ else {'failed': 0, 'passed': 2}
)
"""Under PyPy "coroutine 'foobar' was never awaited" does not happen."""
result.assert_outcomes(**expected_outcomes)
|