diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-12-26 21:16:17 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-12-26 21:16:17 +0100 |
commit | 1385ab70894cd9bafa480d7b7eed82240cd02749 (patch) | |
tree | a5fa43e4679c3a26fff12f150d25d5666a809f73 /tests | |
parent | 5d9276ffb0ac4eba272080821790edf975cbc1f1 (diff) | |
download | trollius-git-1385ab70894cd9bafa480d7b7eed82240cd02749.tar.gz |
CPython doesn't have asyncio.test_support
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_base_events.py | 21 | ||||
-rw-r--r-- | tests/test_events.py | 5 | ||||
-rw-r--r-- | tests/test_futures.py | 5 | ||||
-rw-r--r-- | tests/test_subprocess.py | 5 | ||||
-rw-r--r-- | tests/test_tasks.py | 29 | ||||
-rw-r--r-- | tests/test_windows_utils.py | 5 |
6 files changed, 46 insertions, 24 deletions
diff --git a/tests/test_base_events.py b/tests/test_base_events.py index 5906fb7..6599e4e 100644 --- a/tests/test_base_events.py +++ b/tests/test_base_events.py @@ -13,8 +13,13 @@ from unittest import mock import asyncio from asyncio import base_events from asyncio import constants -from asyncio import test_support as support from asyncio import test_utils +try: + from test import support + from test.script_helper import assert_python_ok +except ImportError: + from asyncio import test_support as support + from asyncio.test_support import assert_python_ok MOCK_ANY = mock.ANY @@ -623,19 +628,19 @@ class BaseEventLoopTests(test_utils.TestCase): # Test with -E to not fail if the unit test was run with # PYTHONASYNCIODEBUG set to a non-empty string - sts, stdout, stderr = support.assert_python_ok('-E', '-c', code) + sts, stdout, stderr = assert_python_ok('-E', '-c', code) self.assertEqual(stdout.rstrip(), b'False') - sts, stdout, stderr = support.assert_python_ok('-c', code, - PYTHONASYNCIODEBUG='') + sts, stdout, stderr = assert_python_ok('-c', code, + PYTHONASYNCIODEBUG='') self.assertEqual(stdout.rstrip(), b'False') - sts, stdout, stderr = support.assert_python_ok('-c', code, - PYTHONASYNCIODEBUG='1') + sts, stdout, stderr = assert_python_ok('-c', code, + PYTHONASYNCIODEBUG='1') self.assertEqual(stdout.rstrip(), b'True') - sts, stdout, stderr = support.assert_python_ok('-E', '-c', code, - PYTHONASYNCIODEBUG='1') + sts, stdout, stderr = assert_python_ok('-E', '-c', code, + PYTHONASYNCIODEBUG='1') self.assertEqual(stdout.rstrip(), b'False') def test_create_task(self): diff --git a/tests/test_events.py b/tests/test_events.py index 04dc880..af2da1f 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -25,8 +25,11 @@ import weakref import asyncio from asyncio import proactor_events from asyncio import selector_events -from asyncio import test_support as support from asyncio import test_utils +try: + from test import support +except ImportError: + from asyncio import test_support as support def data_file(filename): diff --git a/tests/test_futures.py b/tests/test_futures.py index 7c56462..2863709 100644 --- a/tests/test_futures.py +++ b/tests/test_futures.py @@ -8,8 +8,11 @@ import unittest from unittest import mock import asyncio -from asyncio import test_support as support from asyncio import test_utils +try: + from test import support +except ImportError: + from asyncio import test_support as support def _fakefunc(f): diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py index b284e6b..d82cbbf 100644 --- a/tests/test_subprocess.py +++ b/tests/test_subprocess.py @@ -5,8 +5,11 @@ from unittest import mock import asyncio from asyncio import subprocess -from asyncio import test_support as support from asyncio import test_utils +try: + from test import support +except ImportError: + from asyncio import test_support as support if sys.platform != 'win32': from asyncio import unix_events diff --git a/tests/test_tasks.py b/tests/test_tasks.py index c005366..1520fb4 100644 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -10,8 +10,13 @@ from unittest import mock import asyncio from asyncio import coroutines -from asyncio import test_support as support from asyncio import test_utils +try: + from test import support + from test.script_helper import assert_python_ok +except ImportError: + from asyncio import test_support as support + from asyncio.test_support import assert_python_ok PY34 = (sys.version_info >= (3, 4)) @@ -1776,23 +1781,23 @@ class GatherTestsBase: # Test with -E to not fail if the unit test was run with # PYTHONASYNCIODEBUG set to a non-empty string - sts, stdout, stderr = support.assert_python_ok('-E', '-c', code, - PYTHONPATH=aio_path) + sts, stdout, stderr = assert_python_ok('-E', '-c', code, + PYTHONPATH=aio_path) self.assertEqual(stdout.rstrip(), b'False') - sts, stdout, stderr = support.assert_python_ok('-c', code, - PYTHONASYNCIODEBUG='', - PYTHONPATH=aio_path) + sts, stdout, stderr = assert_python_ok('-c', code, + PYTHONASYNCIODEBUG='', + PYTHONPATH=aio_path) self.assertEqual(stdout.rstrip(), b'False') - sts, stdout, stderr = support.assert_python_ok('-c', code, - PYTHONASYNCIODEBUG='1', - PYTHONPATH=aio_path) + sts, stdout, stderr = assert_python_ok('-c', code, + PYTHONASYNCIODEBUG='1', + PYTHONPATH=aio_path) self.assertEqual(stdout.rstrip(), b'True') - sts, stdout, stderr = support.assert_python_ok('-E', '-c', code, - PYTHONASYNCIODEBUG='1', - PYTHONPATH=aio_path) + sts, stdout, stderr = assert_python_ok('-E', '-c', code, + PYTHONASYNCIODEBUG='1', + PYTHONPATH=aio_path) self.assertEqual(stdout.rstrip(), b'False') diff --git a/tests/test_windows_utils.py b/tests/test_windows_utils.py index 92db24e..af5c453 100644 --- a/tests/test_windows_utils.py +++ b/tests/test_windows_utils.py @@ -11,8 +11,11 @@ if sys.platform != 'win32': import _winapi from asyncio import _overlapped -from asyncio import test_support as support from asyncio import windows_utils +try: + from test import support +except ImportError: + from asyncio import test_support as support class WinsocketpairTests(unittest.TestCase): |