|
1 | 1 | """Tests for tasks.py."""
|
2 | 2 |
|
| 3 | +import os |
3 | 4 | import re
|
4 | 5 | import sys
|
5 | 6 | import types
|
@@ -1768,25 +1769,31 @@ def test_return_exceptions(self):
|
1768 | 1769 | self.assertEqual(fut.result(), [3, 1, exc, exc2])
|
1769 | 1770 |
|
1770 | 1771 | def test_env_var_debug(self):
|
| 1772 | + aio_path = os.path.dirname(os.path.dirname(asyncio.__file__)) |
| 1773 | + |
1771 | 1774 | code = '\n'.join((
|
1772 | 1775 | 'import asyncio.coroutines',
|
1773 | 1776 | 'print(asyncio.coroutines._DEBUG)'))
|
1774 | 1777 |
|
1775 | 1778 | # Test with -E to not fail if the unit test was run with
|
1776 | 1779 | # 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) |
1778 | 1782 | self.assertEqual(stdout.rstrip(), b'False')
|
1779 | 1783 |
|
1780 | 1784 | sts, stdout, stderr = assert_python_ok('-c', code,
|
1781 |
| - PYTHONASYNCIODEBUG='') |
| 1785 | + PYTHONASYNCIODEBUG='', |
| 1786 | + PYTHONPATH=aio_path) |
1782 | 1787 | self.assertEqual(stdout.rstrip(), b'False')
|
1783 | 1788 |
|
1784 | 1789 | sts, stdout, stderr = assert_python_ok('-c', code,
|
1785 |
| - PYTHONASYNCIODEBUG='1') |
| 1790 | + PYTHONASYNCIODEBUG='1', |
| 1791 | + PYTHONPATH=aio_path) |
1786 | 1792 | self.assertEqual(stdout.rstrip(), b'True')
|
1787 | 1793 |
|
1788 | 1794 | sts, stdout, stderr = assert_python_ok('-E', '-c', code,
|
1789 |
| - PYTHONASYNCIODEBUG='1') |
| 1795 | + PYTHONASYNCIODEBUG='1', |
| 1796 | + PYTHONPATH=aio_path) |
1790 | 1797 | self.assertEqual(stdout.rstrip(), b'False')
|
1791 | 1798 |
|
1792 | 1799 |
|
|
0 commit comments