Skip to content

Commit f3e29d2

Browse files
committed
test_tasks: Fix test_env_var_debug to use correct asyncio module (issue python#207)
1 parent 0dfb7bf commit f3e29d2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/test_tasks.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for tasks.py."""
22

3+
import os
34
import re
45
import sys
56
import types
@@ -1768,25 +1769,31 @@ def test_return_exceptions(self):
17681769
self.assertEqual(fut.result(), [3, 1, exc, exc2])
17691770

17701771
def test_env_var_debug(self):
1772+
aio_path = os.path.dirname(os.path.dirname(asyncio.__file__))
1773+
17711774
code = '\n'.join((
17721775
'import asyncio.coroutines',
17731776
'print(asyncio.coroutines._DEBUG)'))
17741777

17751778
# Test with -E to not fail if the unit test was run with
17761779
# PYTHONASYNCIODEBUG set to a non-empty string
1777-
sts, stdout, stderr = assert_python_ok('-E', '-c', code)
1780+
sts, stdout, stderr = assert_python_ok('-E', '-c', code,
1781+
PYTHONPATH=aio_path)
17781782
self.assertEqual(stdout.rstrip(), b'False')
17791783

17801784
sts, stdout, stderr = assert_python_ok('-c', code,
1781-
PYTHONASYNCIODEBUG='')
1785+
PYTHONASYNCIODEBUG='',
1786+
PYTHONPATH=aio_path)
17821787
self.assertEqual(stdout.rstrip(), b'False')
17831788

17841789
sts, stdout, stderr = assert_python_ok('-c', code,
1785-
PYTHONASYNCIODEBUG='1')
1790+
PYTHONASYNCIODEBUG='1',
1791+
PYTHONPATH=aio_path)
17861792
self.assertEqual(stdout.rstrip(), b'True')
17871793

17881794
sts, stdout, stderr = assert_python_ok('-E', '-c', code,
1789-
PYTHONASYNCIODEBUG='1')
1795+
PYTHONASYNCIODEBUG='1',
1796+
PYTHONPATH=aio_path)
17901797
self.assertEqual(stdout.rstrip(), b'False')
17911798

17921799

0 commit comments

Comments
 (0)