Title: test_asyncio: test_debug_mode_interop() fails using -Werror
Type: Stage: resolved
Components: asyncio, Tests Versions: Python 3.9, Python 3.8
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, miss-islington, vstinner, xtreak, yselivanov
Priority: normal Keywords: patch

Created on 2019-06-17 20:37 by vstinner, last changed 2019-06-22 11:16 by asvetlov. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 14293 merged xtreak, 2019-06-21 18:35
PR 14305 merged miss-islington, 2019-06-22 10:25
Messages (6)
msg345904 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-06-17 20:37
vstinner@apu$ PYTHONWARNINGS=error ./python -Werror -m test -v test_asyncio -m test_debug_mode_interop
== CPython 3.9.0a0 (heads/master-dirty:00f6493084, Jun 17 2019, 21:50:32) [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
== Linux-5.1.6-300.fc30.x86_64-x86_64-with-glibc2.29 little-endian
== cwd: /home/vstinner/prog/python/master/build/test_python_23510
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
Run tests sequentially
0:00:00 load avg: 0.73 [1/1] test_asyncio
test_debug_mode_interop (test.test_asyncio.test_tasks.CompatibilityTests) ... FAIL

FAIL: test_debug_mode_interop (test.test_asyncio.test_tasks.CompatibilityTests)
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/test/test_asyncio/", line 3355, in test_debug_mode_interop
    assert_python_ok("-c", code, PYTHONASYNCIODEBUG="1")
  File "/home/vstinner/prog/python/master/Lib/test/support/", line 157, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
  File "/home/vstinner/prog/python/master/Lib/test/support/", line 143, in _assert_python
  File "/home/vstinner/prog/python/master/Lib/test/support/", line 70, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 1
command line: ['/home/vstinner/prog/python/master/python', '-X', 'faulthandler', '-c', '\nimport asyncio\n\nasync def native_coro():\n    pass\n\n@asyncio.coroutine\ndef old_style_coro():\n    yield from native_coro()\n\\n']



Traceback (most recent call last):
  File "<string>", line 8, in <module>
  File "/home/vstinner/prog/python/master/Lib/asyncio/", line 111, in coroutine
    warnings.warn('"@coroutine" decorator is deprecated since Python 3.8, use "async def" instead',
DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead


Ran 1 test in 0.210s

FAILED (failures=1)
test test_asyncio failed
test_asyncio failed

== Tests result: FAILURE ==

1 test failed:

Total duration: 598 ms
Tests result: FAILURE
msg345907 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-06-17 20:50
def test_debug_mode_interop(self):
        code = textwrap.dedent("""
            import asyncio

            async def native_coro():

            def old_style_coro():
                yield from native_coro()

        assert_python_ok("-c", code, PYTHONASYNCIODEBUG="1")
msg345913 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-06-17 21:24
It affects 3.8 as well since was merged and I guess the fix would be to wrap it with assertWarns(DeprecationWarning) context manager like other tests. Interesting, does PYTHONWARNINGS=error affects the interpreter spawn by assert_python_ok to change warnings level which -Werror doesn't do by itself?
msg345997 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-06-18 16:20
Sorry, I was wrong PYTHONWARNINGS environment variable is still passed to subprocess created by assert_python_ok so using assertWarns doesn't suppress it. Perhaps the DeprecationWarning could be ignored in assert_python_ok like below with -W :

diff --git a/Lib/test/test_asyncio/ b/Lib/test/test_asyncio/
index 22a49077d5..d5f44b8091 100644
--- a/Lib/test/test_asyncio/
+++ b/Lib/test/test_asyncio/
@@ -3352,7 +3352,9 @@ class CompatibilityTests(test_utils.TestCase):

-        assert_python_ok("-c", code, PYTHONASYNCIODEBUG="1")
+        assert_python_ok("-Wignore::DeprecationWarning", "-c", code,
+                         PYTHONASYNCIODEBUG="1")

 if __name__ == '__main__':
msg346274 - (view) Author: miss-islington (miss-islington) Date: 2019-06-22 10:25
New changeset 186f70905d07b42a9cbf0a29e448f30baf2b53cb by Miss Islington (bot) (Xtreak) in branch 'master':
bpo-37323: Suppress DeprecationWarning raised by @asyncio.coroutine (GH-14293)
msg346275 - (view) Author: miss-islington (miss-islington) Date: 2019-06-22 10:43
New changeset 9b32b44d3ec298e02c33fea1aa842f52c9650243 by Miss Islington (bot) in branch '3.8':
bpo-37323: Suppress DeprecationWarning raised by @asyncio.coroutine (GH-14293)
Date User Action Args
2019-06-22 11:16:48asvetlovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-06-22 10:43:11miss-islingtonsetmessages: + msg346275
2019-06-22 10:25:42miss-islingtonsetpull_requests: + pull_request14129
2019-06-22 10:25:33miss-islingtonsetnosy: + miss-islington
messages: + msg346274
2019-06-21 18:35:37xtreaksetkeywords: + patch
stage: patch review
pull_requests: + pull_request14118
2019-06-18 16:20:27xtreaksetmessages: + msg345997
2019-06-17 21:24:52xtreaksetversions: + Python 3.8
nosy: + asvetlov, xtreak, yselivanov

messages: + msg345913

components: + asyncio
2019-06-17 20:50:02vstinnersetmessages: + msg345907
2019-06-17 20:37:03vstinnercreate