Skip to content

Commit

Permalink
bpo-32273: Move asyncio.test_utils to test.test_asyncio (#4785)
Browse files Browse the repository at this point in the history
  • Loading branch information
1st1 authored Dec 11, 2017
1 parent 9edad3c commit 3e97518
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 61 deletions.
15 changes: 3 additions & 12 deletions Lib/test/test_asyncio/test_base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions Lib/test/test_asyncio/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import collections.abc
import concurrent.futures
import functools
import gc
import io
import os
import platform
Expand All @@ -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:
Expand Down
7 changes: 2 additions & 5 deletions Lib/test/test_asyncio/test_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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>.*?)'
Expand Down
7 changes: 2 additions & 5 deletions Lib/test/test_asyncio/test_pep492.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_proactor_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_selector_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_sslproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 3 additions & 5 deletions Lib/test/test_asyncio/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 3 additions & 12 deletions Lib/test/test_asyncio/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_windows_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
7 changes: 1 addition & 6 deletions Lib/test/test_asyncio/test_windows_utils.py
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions Lib/asyncio/test_utils.py → Lib/test/test_asyncio/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move asyncio.test_utils to test.test_asyncio.

0 comments on commit 3e97518

Please sign in to comment.