summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/__init__.py6
-rw-r--r--Lib/test/test_asyncio/test_base_events.py9
-rw-r--r--Lib/test/test_asyncio/test_sendfile.py7
-rw-r--r--Lib/test/test_asyncio/test_subprocess.py7
-rw-r--r--Lib/test/test_asyncio/test_unix_events.py8
5 files changed, 21 insertions, 16 deletions
diff --git a/Lib/test/test_asyncio/__init__.py b/Lib/test/test_asyncio/__init__.py
index c77c7a8..5d41504 100644
--- a/Lib/test/test_asyncio/__init__.py
+++ b/Lib/test/test_asyncio/__init__.py
@@ -1,8 +1,10 @@
import os
-from test.support import load_package_tests, import_module
+from test.support import load_package_tests
+from test.support import import_helper
+
# Skip tests if we don't have concurrent.futures.
-import_module('concurrent.futures')
+import_helper.import_module('concurrent.futures')
def load_tests(*args):
return load_package_tests(os.path.dirname(__file__), *args)
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
index 533d5cc..f74dabc 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -16,6 +16,7 @@ from asyncio import constants
from test.test_asyncio import utils as test_utils
from test import support
from test.support.script_helper import assert_python_ok
+from test.support import os_helper
from test.support import socket_helper
@@ -1983,14 +1984,14 @@ class BaseLoopSockSendfileTests(test_utils.TestCase):
def setUpClass(cls):
cls.__old_bufsize = constants.SENDFILE_FALLBACK_READBUFFER_SIZE
constants.SENDFILE_FALLBACK_READBUFFER_SIZE = 1024 * 16
- with open(support.TESTFN, 'wb') as fp:
+ with open(os_helper.TESTFN, 'wb') as fp:
fp.write(cls.DATA)
super().setUpClass()
@classmethod
def tearDownClass(cls):
constants.SENDFILE_FALLBACK_READBUFFER_SIZE = cls.__old_bufsize
- support.unlink(support.TESTFN)
+ os_helper.unlink(os_helper.TESTFN)
super().tearDownClass()
def setUp(self):
@@ -1998,7 +1999,7 @@ class BaseLoopSockSendfileTests(test_utils.TestCase):
# BaseSelectorEventLoop() has no native implementation
self.loop = BaseSelectorEventLoop()
self.set_event_loop(self.loop)
- self.file = open(support.TESTFN, 'rb')
+ self.file = open(os_helper.TESTFN, 'rb')
self.addCleanup(self.file.close)
super().setUp()
@@ -2095,7 +2096,7 @@ class BaseLoopSockSendfileTests(test_utils.TestCase):
def test_nonbinary_file(self):
sock = self.make_socket()
- with open(support.TESTFN, 'r') as f:
+ with open(os_helper.TESTFN, 'r') as f:
with self.assertRaisesRegex(ValueError, "binary mode"):
self.run_loop(self.loop.sock_sendfile(sock, f))
diff --git a/Lib/test/test_asyncio/test_sendfile.py b/Lib/test/test_asyncio/test_sendfile.py
index dbce199..a30d9b9 100644
--- a/Lib/test/test_asyncio/test_sendfile.py
+++ b/Lib/test/test_asyncio/test_sendfile.py
@@ -10,6 +10,7 @@ from asyncio import base_events
from asyncio import constants
from unittest import mock
from test import support
+from test.support import os_helper
from test.support import socket_helper
from test.test_asyncio import utils as test_utils
@@ -98,17 +99,17 @@ class SendfileBase:
@classmethod
def setUpClass(cls):
- with open(support.TESTFN, 'wb') as fp:
+ with open(os_helper.TESTFN, 'wb') as fp:
fp.write(cls.DATA)
super().setUpClass()
@classmethod
def tearDownClass(cls):
- support.unlink(support.TESTFN)
+ os_helper.unlink(os_helper.TESTFN)
super().tearDownClass()
def setUp(self):
- self.file = open(support.TESTFN, 'rb')
+ self.file = open(os_helper.TESTFN, 'rb')
self.addCleanup(self.file.close)
self.loop = self.create_event_loop()
self.set_event_loop(self.loop)
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
index 6657a88..177a02c 100644
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -10,6 +10,7 @@ from asyncio import base_subprocess
from asyncio import subprocess
from test.test_asyncio import utils as test_utils
from test import support
+from test.support import os_helper
if sys.platform != 'win32':
from asyncio import unix_events
@@ -626,10 +627,10 @@ class SubprocessMixin:
def test_create_subprocess_exec_with_path(self):
async def execute():
p = await subprocess.create_subprocess_exec(
- support.FakePath(sys.executable), '-c', 'pass')
+ os_helper.FakePath(sys.executable), '-c', 'pass')
await p.wait()
p = await subprocess.create_subprocess_exec(
- sys.executable, '-c', 'pass', support.FakePath('.'))
+ sys.executable, '-c', 'pass', os_helper.FakePath('.'))
await p.wait()
self.assertIsNone(self.loop.run_until_complete(execute()))
@@ -737,7 +738,7 @@ class GenericWatcherTests:
with self.assertRaises(RuntimeError):
await subprocess.create_subprocess_exec(
- support.FakePath(sys.executable), '-c', 'pass')
+ os_helper.FakePath(sys.executable), '-c', 'pass')
watcher.add_child_handler.assert_not_called()
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index 10bd46d..2c7d52a 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -14,7 +14,7 @@ import tempfile
import threading
import unittest
from unittest import mock
-from test import support
+from test.support import os_helper
from test.support import socket_helper
if sys.platform == 'win32':
@@ -467,19 +467,19 @@ class SelectorEventLoopUnixSockSendfileTests(test_utils.TestCase):
@classmethod
def setUpClass(cls):
- with open(support.TESTFN, 'wb') as fp:
+ with open(os_helper.TESTFN, 'wb') as fp:
fp.write(cls.DATA)
super().setUpClass()
@classmethod
def tearDownClass(cls):
- support.unlink(support.TESTFN)
+ os_helper.unlink(os_helper.TESTFN)
super().tearDownClass()
def setUp(self):
self.loop = asyncio.new_event_loop()
self.set_event_loop(self.loop)
- self.file = open(support.TESTFN, 'rb')
+ self.file = open(os_helper.TESTFN, 'rb')
self.addCleanup(self.file.close)
super().setUp()