mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
asyncio.test_tasks: Fix test_env_var_debug to use correct asyncio module
This commit is contained in:
parent
592ada9b4b
commit
d5a8f5807f
1 changed files with 11 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
"""Tests for tasks.py."""
|
"""Tests for tasks.py."""
|
||||||
|
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
|
@ -1768,25 +1769,31 @@ class GatherTestsBase:
|
||||||
self.assertEqual(fut.result(), [3, 1, exc, exc2])
|
self.assertEqual(fut.result(), [3, 1, exc, exc2])
|
||||||
|
|
||||||
def test_env_var_debug(self):
|
def test_env_var_debug(self):
|
||||||
|
aio_path = os.path.dirname(os.path.dirname(asyncio.__file__))
|
||||||
|
|
||||||
code = '\n'.join((
|
code = '\n'.join((
|
||||||
'import asyncio.coroutines',
|
'import asyncio.coroutines',
|
||||||
'print(asyncio.coroutines._DEBUG)'))
|
'print(asyncio.coroutines._DEBUG)'))
|
||||||
|
|
||||||
# Test with -E to not fail if the unit test was run with
|
# Test with -E to not fail if the unit test was run with
|
||||||
# PYTHONASYNCIODEBUG set to a non-empty string
|
# PYTHONASYNCIODEBUG set to a non-empty string
|
||||||
sts, stdout, stderr = assert_python_ok('-E', '-c', code)
|
sts, stdout, stderr = assert_python_ok('-E', '-c', code,
|
||||||
|
PYTHONPATH=aio_path)
|
||||||
self.assertEqual(stdout.rstrip(), b'False')
|
self.assertEqual(stdout.rstrip(), b'False')
|
||||||
|
|
||||||
sts, stdout, stderr = assert_python_ok('-c', code,
|
sts, stdout, stderr = assert_python_ok('-c', code,
|
||||||
PYTHONASYNCIODEBUG='')
|
PYTHONASYNCIODEBUG='',
|
||||||
|
PYTHONPATH=aio_path)
|
||||||
self.assertEqual(stdout.rstrip(), b'False')
|
self.assertEqual(stdout.rstrip(), b'False')
|
||||||
|
|
||||||
sts, stdout, stderr = assert_python_ok('-c', code,
|
sts, stdout, stderr = assert_python_ok('-c', code,
|
||||||
PYTHONASYNCIODEBUG='1')
|
PYTHONASYNCIODEBUG='1',
|
||||||
|
PYTHONPATH=aio_path)
|
||||||
self.assertEqual(stdout.rstrip(), b'True')
|
self.assertEqual(stdout.rstrip(), b'True')
|
||||||
|
|
||||||
sts, stdout, stderr = assert_python_ok('-E', '-c', code,
|
sts, stdout, stderr = assert_python_ok('-E', '-c', code,
|
||||||
PYTHONASYNCIODEBUG='1')
|
PYTHONASYNCIODEBUG='1',
|
||||||
|
PYTHONPATH=aio_path)
|
||||||
self.assertEqual(stdout.rstrip(), b'False')
|
self.assertEqual(stdout.rstrip(), b'False')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue