[Python-checkins] bpo-32273: Move asyncio.test_utils to test.test_asyncio (#4785)
Yury Selivanov
webhook-mailer at python.org
Mon Dec 11 10:04:43 EST 2017
https://github.com/python/cpython/commit/3e9751819ad13a965e8be13c1e5bc5a6811fe6b8
commit: 3e9751819ad13a965e8be13c1e5bc5a6811fe6b8
branch: master
author: Yury Selivanov <yury at magic.io>
committer: GitHub <noreply at github.com>
date: 2017-12-11T10:04:40-05:00
summary:
bpo-32273: Move asyncio.test_utils to test.test_asyncio (#4785)
files:
A Lib/test/test_asyncio/utils.py
A Misc/NEWS.d/next/Library/2017-12-10-19-14-55.bpo-32273.5KKlCv.rst
D Lib/asyncio/test_utils.py
M Lib/test/test_asyncio/test_base_events.py
M Lib/test/test_asyncio/test_events.py
M Lib/test/test_asyncio/test_futures.py
M Lib/test/test_asyncio/test_locks.py
M Lib/test/test_asyncio/test_pep492.py
M Lib/test/test_asyncio/test_proactor_events.py
M Lib/test/test_asyncio/test_queues.py
M Lib/test/test_asyncio/test_selector_events.py
M Lib/test/test_asyncio/test_sslproto.py
M Lib/test/test_asyncio/test_streams.py
M Lib/test/test_asyncio/test_subprocess.py
M Lib/test/test_asyncio/test_tasks.py
M Lib/test/test_asyncio/test_unix_events.py
M Lib/test/test_asyncio/test_windows_events.py
M Lib/test/test_asyncio/test_windows_utils.py
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
index 6561a9df779..8b08ed16634 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -14,18 +14,9 @@
import asyncio
from asyncio import base_events
from asyncio import constants
-from asyncio import test_utils
-try:
- from test import support
-except ImportError:
- from asyncio import test_support as support
-try:
- from test.support.script_helper import assert_python_ok
-except ImportError:
- try:
- from test.script_helper import assert_python_ok
- except ImportError:
- from asyncio.test_support import assert_python_ok
+from test.test_asyncio import utils as test_utils
+from test import support
+from test.support.script_helper import assert_python_ok
MOCK_ANY = mock.ANY
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index 01300246fda..39d5bb54a9d 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -3,7 +3,6 @@
import collections.abc
import concurrent.futures
import functools
-import gc
import io
import os
import platform
@@ -30,8 +29,7 @@
from asyncio import coroutines
from asyncio import proactor_events
from asyncio import selector_events
-from asyncio import sslproto
-from asyncio import test_utils
+from test.test_asyncio import utils as test_utils
try:
from test import support
except ImportError:
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py
index 4320a901f49..444d1df02be 100644
--- a/Lib/test/test_asyncio/test_futures.py
+++ b/Lib/test/test_asyncio/test_futures.py
@@ -9,12 +9,9 @@
from unittest import mock
import asyncio
-from asyncio import test_utils
from asyncio import futures
-try:
- from test import support
-except ImportError:
- from asyncio import test_support as support
+from test.test_asyncio import utils as test_utils
+from test import support
def _fakefunc(f):
diff --git a/Lib/test/test_asyncio/test_locks.py b/Lib/test/test_asyncio/test_locks.py
index 78d80ecf4f3..3c5069778b5 100644
--- a/Lib/test/test_asyncio/test_locks.py
+++ b/Lib/test/test_asyncio/test_locks.py
@@ -5,7 +5,7 @@
import re
import asyncio
-from asyncio import test_utils
+from test.test_asyncio import utils as test_utils
STR_RGX_REPR = (
r'^<(?P<class>.*?) object at (?P<address>.*?)'
diff --git a/Lib/test/test_asyncio/test_pep492.py b/Lib/test/test_asyncio/test_pep492.py
index 442577017d9..8dd0c25e7cf 100644
--- a/Lib/test/test_asyncio/test_pep492.py
+++ b/Lib/test/test_asyncio/test_pep492.py
@@ -3,14 +3,11 @@
import types
import unittest
-try:
- from test import support
-except ImportError:
- from asyncio import test_support as support
+from test import support
from unittest import mock
import asyncio
-from asyncio import test_utils
+from test.test_asyncio import utils as test_utils
class BaseTest(test_utils.TestCase):
diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py
index def08b96ab0..7ccc6814b2e 100644
--- a/Lib/test/test_asyncio/test_proactor_events.py
+++ b/Lib/test/test_asyncio/test_proactor_events.py
@@ -9,7 +9,7 @@
from asyncio.proactor_events import _ProactorSocketTransport
from asyncio.proactor_events import _ProactorWritePipeTransport
from asyncio.proactor_events import _ProactorDuplexPipeTransport
-from asyncio import test_utils
+from test.test_asyncio import utils as test_utils
def close_transport(transport):
diff --git a/Lib/test/test_asyncio/test_queues.py b/Lib/test/test_asyncio/test_queues.py
index 3b66d616f8e..8d78546318a 100644
--- a/Lib/test/test_asyncio/test_queues.py
+++ b/Lib/test/test_asyncio/test_queues.py
@@ -4,7 +4,7 @@
from unittest import mock
import asyncio
-from asyncio import test_utils
+from test.test_asyncio import utils as test_utils
class _QueueTestBase(test_utils.TestCase):
diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py
index 616eb6f2630..24feb30e3d5 100644
--- a/Lib/test/test_asyncio/test_selector_events.py
+++ b/Lib/test/test_asyncio/test_selector_events.py
@@ -11,11 +11,11 @@
ssl = None
import asyncio
-from asyncio import test_utils
from asyncio.selector_events import BaseSelectorEventLoop
from asyncio.selector_events import _SelectorTransport
from asyncio.selector_events import _SelectorSocketTransport
from asyncio.selector_events import _SelectorDatagramTransport
+from test.test_asyncio import utils as test_utils
MOCK_ANY = mock.ANY
diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py
index f573ae8fe77..7650fe6bd46 100644
--- a/Lib/test/test_asyncio/test_sslproto.py
+++ b/Lib/test/test_asyncio/test_sslproto.py
@@ -11,7 +11,7 @@
import asyncio
from asyncio import log
from asyncio import sslproto
-from asyncio import test_utils
+from test.test_asyncio import utils as test_utils
@unittest.skipIf(ssl is None, 'No ssl module')
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py
index 1927d731281..7a0762cfa3b 100644
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -16,7 +16,7 @@
ssl = None
import asyncio
-from asyncio import test_utils
+from test.test_asyncio import utils as test_utils
class StreamReaderTests(test_utils.TestCase):
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
index ad4bb149559..81b08d6c292 100644
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -7,11 +7,9 @@
import asyncio
from asyncio import base_subprocess
from asyncio import subprocess
-from asyncio import test_utils
-try:
- from test import support
-except ImportError:
- from asyncio import test_support as support
+from test.test_asyncio import utils as test_utils
+from test import support
+
if sys.platform != 'win32':
from asyncio import unix_events
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index cdc882a9bee..071481dbc26 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -17,18 +17,9 @@
from asyncio import coroutines
from asyncio import futures
from asyncio import tasks
-from asyncio import test_utils
-try:
- from test import support
-except ImportError:
- from asyncio import test_support as support
-try:
- from test.support.script_helper import assert_python_ok
-except ImportError:
- try:
- from test.script_helper import assert_python_ok
- except ImportError:
- from asyncio.test_support import assert_python_ok
+from test.test_asyncio import utils as test_utils
+from test import support
+from test.support.script_helper import assert_python_ok
@asyncio.coroutine
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index 6746b34fe2c..e13cc3749da 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -21,8 +21,8 @@
import asyncio
from asyncio import log
-from asyncio import test_utils
from asyncio import unix_events
+from test.test_asyncio import utils as test_utils
MOCK_ANY = mock.ANY
diff --git a/Lib/test/test_asyncio/test_windows_events.py b/Lib/test/test_asyncio/test_windows_events.py
index de6fe120612..fdba636f207 100644
--- a/Lib/test/test_asyncio/test_windows_events.py
+++ b/Lib/test/test_asyncio/test_windows_events.py
@@ -11,8 +11,8 @@
import _winapi
import asyncio
-from asyncio import test_utils
from asyncio import windows_events
+from test.test_asyncio import utils as test_utils
class UpperProto(asyncio.Protocol):
diff --git a/Lib/test/test_asyncio/test_windows_utils.py b/Lib/test/test_asyncio/test_windows_utils.py
index 952f95e5730..9fc38586ab0 100644
--- a/Lib/test/test_asyncio/test_windows_utils.py
+++ b/Lib/test/test_asyncio/test_windows_utils.py
@@ -1,10 +1,8 @@
"""Tests for window_utils"""
-import socket
import sys
import unittest
import warnings
-from unittest import mock
if sys.platform != 'win32':
raise unittest.SkipTest('Windows only')
@@ -13,10 +11,7 @@
import _winapi
from asyncio import windows_utils
-try:
- from test import support
-except ImportError:
- from asyncio import test_support as support
+from test import support
class PipeTests(unittest.TestCase):
diff --git a/Lib/asyncio/test_utils.py b/Lib/test/test_asyncio/utils.py
similarity index 98%
rename from Lib/asyncio/test_utils.py
rename to Lib/test/test_asyncio/utils.py
index 231916970c7..560db9f562d 100644
--- a/Lib/asyncio/test_utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -26,11 +26,11 @@
except ImportError: # pragma: no cover
ssl = None
-from . import base_events
-from . import events
-from . import futures
-from . import tasks
-from .log import logger
+from asyncio import base_events
+from asyncio import events
+from asyncio import futures
+from asyncio import tasks
+from asyncio.log import logger
from test import support
diff --git a/Misc/NEWS.d/next/Library/2017-12-10-19-14-55.bpo-32273.5KKlCv.rst b/Misc/NEWS.d/next/Library/2017-12-10-19-14-55.bpo-32273.5KKlCv.rst
new file mode 100644
index 00000000000..3bbec8f6e34
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2017-12-10-19-14-55.bpo-32273.5KKlCv.rst
@@ -0,0 +1 @@
+Move asyncio.test_utils to test.test_asyncio.
More information about the Python-checkins
mailing list