[Python-checkins] cpython: asyncio.test_tasks: Fix test_env_var_debug to use correct asyncio module

yury.selivanov python-checkins at python.org
Fri Sep 26 01:12:47 CEST 2014


https://hg.python.org/cpython/rev/5226f89437ed
changeset:   92582:5226f89437ed
parent:      92580:bfdb995e8d7d
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Thu Sep 25 19:12:37 2014 -0400
summary:
  asyncio.test_tasks: Fix test_env_var_debug to use correct asyncio module

files:
  Lib/test/test_asyncio/test_tasks.py |  15 +++++++++++----
  1 files changed, 11 insertions(+), 4 deletions(-)


diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -1,5 +1,6 @@
 """Tests for tasks.py."""
 
+import os
 import re
 import sys
 import types
@@ -1768,25 +1769,31 @@
         self.assertEqual(fut.result(), [3, 1, exc, exc2])
 
     def test_env_var_debug(self):
+        aio_path = os.path.dirname(os.path.dirname(asyncio.__file__))
+
         code = '\n'.join((
             'import asyncio.coroutines',
             'print(asyncio.coroutines._DEBUG)'))
 
         # Test with -E to not fail if the unit test was run with
         # 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')
 
         sts, stdout, stderr = assert_python_ok('-c', code,
-                                               PYTHONASYNCIODEBUG='')
+                                               PYTHONASYNCIODEBUG='',
+                                               PYTHONPATH=aio_path)
         self.assertEqual(stdout.rstrip(), b'False')
 
         sts, stdout, stderr = assert_python_ok('-c', code,
-                                               PYTHONASYNCIODEBUG='1')
+                                               PYTHONASYNCIODEBUG='1',
+                                               PYTHONPATH=aio_path)
         self.assertEqual(stdout.rstrip(), b'True')
 
         sts, stdout, stderr = assert_python_ok('-E', '-c', code,
-                                               PYTHONASYNCIODEBUG='1')
+                                               PYTHONASYNCIODEBUG='1',
+                                               PYTHONPATH=aio_path)
         self.assertEqual(stdout.rstrip(), b'False')
 
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list