diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2014-12-19 22:18:09 +0100 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2014-12-19 22:18:09 +0100 |
| commit | 2b06827fbbd4300c914f098eb5b0172e6c8d78ca (patch) | |
| tree | c64b802b79d6616a0b3eedf722e10c7cf3e2ce08 /tests | |
| parent | cd4007814d635e1da805bd353afbff30942e0892 (diff) | |
| download | trollius-git-2b06827fbbd4300c914f098eb5b0172e6c8d78ca.tar.gz | |
asyncio.test_support now uses test.support and test.script_helper if available
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 | 8 |
6 files changed, 25 insertions, 48 deletions
diff --git a/tests/test_base_events.py b/tests/test_base_events.py index 4e5b6ca..afb65b2 100644 --- a/tests/test_base_events.py +++ b/tests/test_base_events.py @@ -12,13 +12,8 @@ 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.script_helper import assert_python_ok - from test import support -except ImportError: - from asyncio import test_support as support - from asyncio.test_support import assert_python_ok MOCK_ANY = mock.ANY @@ -584,19 +579,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 = assert_python_ok('-E', '-c', code) + sts, stdout, stderr = support.assert_python_ok('-E', '-c', code) self.assertEqual(stdout.rstrip(), b'False') - sts, stdout, stderr = assert_python_ok('-c', code, - PYTHONASYNCIODEBUG='') + sts, stdout, stderr = support.assert_python_ok('-c', code, + PYTHONASYNCIODEBUG='') self.assertEqual(stdout.rstrip(), b'False') - sts, stdout, stderr = assert_python_ok('-c', code, - PYTHONASYNCIODEBUG='1') + sts, stdout, stderr = support.assert_python_ok('-c', code, + PYTHONASYNCIODEBUG='1') self.assertEqual(stdout.rstrip(), b'True') - sts, stdout, stderr = assert_python_ok('-E', '-c', code, - PYTHONASYNCIODEBUG='1') + sts, stdout, stderr = support.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 0630292..04dc880 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -25,11 +25,8 @@ 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 # find_unused_port, IPV6_ENABLED, TEST_HOME_DIR -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 f9c3ad2..7c56462 100644 --- a/tests/test_futures.py +++ b/tests/test_futures.py @@ -8,11 +8,8 @@ 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 # gc_collect -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 08c8ac2..5cb0f03 100644 --- a/tests/test_subprocess.py +++ b/tests/test_subprocess.py @@ -5,13 +5,10 @@ from unittest import mock import asyncio from asyncio import subprocess +from asyncio import test_support as support from asyncio import test_utils if sys.platform != 'win32': from asyncio import unix_events -try: - from test import support # PIPE_MAX_SIZE -except ImportError: - from asyncio import test_support as support # Program blocking PROGRAM_BLOCKED = [sys.executable, '-c', 'import time; time.sleep(3600)'] diff --git a/tests/test_tasks.py b/tests/test_tasks.py index 25b21dc..c005366 100644 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -7,15 +7,10 @@ import types import unittest import weakref from unittest import mock -try: - from test import support # gc_collect - 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 import asyncio from asyncio import coroutines +from asyncio import test_support as support from asyncio import test_utils @@ -1781,23 +1776,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 = assert_python_ok('-E', '-c', code, - PYTHONPATH=aio_path) + sts, stdout, stderr = support.assert_python_ok('-E', '-c', code, + PYTHONPATH=aio_path) self.assertEqual(stdout.rstrip(), b'False') - sts, stdout, stderr = assert_python_ok('-c', code, - PYTHONASYNCIODEBUG='', - PYTHONPATH=aio_path) + sts, stdout, stderr = support.assert_python_ok('-c', code, + PYTHONASYNCIODEBUG='', + PYTHONPATH=aio_path) self.assertEqual(stdout.rstrip(), b'False') - sts, stdout, stderr = assert_python_ok('-c', code, - PYTHONASYNCIODEBUG='1', - PYTHONPATH=aio_path) + sts, stdout, stderr = support.assert_python_ok('-c', code, + PYTHONASYNCIODEBUG='1', + PYTHONPATH=aio_path) self.assertEqual(stdout.rstrip(), b'True') - sts, stdout, stderr = assert_python_ok('-E', '-c', code, - PYTHONASYNCIODEBUG='1', - PYTHONPATH=aio_path) + sts, stdout, stderr = support.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 b957949..92db24e 100644 --- a/tests/test_windows_utils.py +++ b/tests/test_windows_utils.py @@ -5,18 +5,14 @@ import sys import unittest from unittest import mock -try: - from test import support # gc_collect, IPV6_ENABLED -except ImportError: - from asyncio import test_support as support - if sys.platform != 'win32': raise unittest.SkipTest('Windows only') import _winapi -from asyncio import windows_utils from asyncio import _overlapped +from asyncio import test_support as support +from asyncio import windows_utils class WinsocketpairTests(unittest.TestCase): |
