asyncio.test_support now uses test.support and test.script_helper if available
This commit is contained in:
@@ -290,3 +290,15 @@ def requires_freebsd_version(*min_version):
|
||||
version is less than 7.2.
|
||||
"""
|
||||
return _requires_unix_version('FreeBSD', min_version)
|
||||
|
||||
# Use test.support if available
|
||||
try:
|
||||
from test.support import *
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# Use test.script_helper if available
|
||||
try:
|
||||
from test.script_helper import assert_python_ok
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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)']
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user