New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_asyncio: test_debug_mode_interop() fails using -Werror #81504
Comments
vstinner@apu$ PYTHONWARNINGS=error ./python -Werror -m test -v test_asyncio -m test_debug_mode_interop ====================================================================== Traceback (most recent call last):
File "/home/vstinner/prog/python/master/Lib/test/test_asyncio/test_tasks.py", line 3355, in test_debug_mode_interop
assert_python_ok("-c", code, PYTHONASYNCIODEBUG="1")
File "/home/vstinner/prog/python/master/Lib/test/support/script_helper.py", line 157, in assert_python_ok
return _assert_python(True, *args, **env_vars)
File "/home/vstinner/prog/python/master/Lib/test/support/script_helper.py", line 143, in _assert_python
res.fail(cmd_line)
File "/home/vstinner/prog/python/master/Lib/test/support/script_helper.py", 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\nasyncio.run(old_style_coro())\n'] stdout: --- stderr: Traceback (most recent call last):
File "<string>", line 8, in <module>
File "/home/vstinner/prog/python/master/Lib/asyncio/coroutines.py", 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) == Tests result: FAILURE == 1 test failed: Total duration: 598 ms |
def test_debug_mode_interop(self):
# https://bugs.python.org/issue32636
code = textwrap.dedent("""
import asyncio
async def native_coro():
pass
@asyncio.coroutine
def old_style_coro():
yield from native_coro()
asyncio.run(old_style_coro())
""")
assert_python_ok("-c", code, PYTHONASYNCIODEBUG="1") |
It affects 3.8 as well since #13346 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? |
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/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py asyncio.run(old_style_coro())
""")
- assert_python_ok("-c", code, PYTHONASYNCIODEBUG="1")
+
+ assert_python_ok("-Wignore::DeprecationWarning", "-c", code,
+ PYTHONASYNCIODEBUG="1") if __name__ == '__main__': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: