Skip to content

Commit d8a2d75

Browse files
committed
asyncio: sync with Tulip
1 parent dff4004 commit d8a2d75

6 files changed

Lines changed: 37 additions & 16 deletions

File tree

Lib/test/test_asyncio/test_base_events.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@
88
import time
99
import unittest
1010
from unittest import mock
11-
from test.script_helper import assert_python_ok
12-
from test.support import IPV6_ENABLED, gc_collect
1311

1412
import asyncio
1513
from asyncio import base_events
1614
from asyncio import constants
1715
from asyncio import test_utils
16+
try:
17+
from test.script_helper import assert_python_ok
18+
from test import support
19+
except ImportError:
20+
from asyncio import test_support as support
21+
from asyncio.test_support import assert_python_ok
1822

1923

2024
MOCK_ANY = mock.ANY
@@ -634,7 +638,7 @@ def raise_keyboard_interrupt():
634638
except KeyboardInterrupt:
635639
pass
636640
self.loop.close()
637-
gc_collect()
641+
support.gc_collect()
638642

639643
self.assertFalse(self.loop.call_exception_handler.called)
640644

@@ -1066,7 +1070,7 @@ def test_create_datagram_endpoint_socket_err(self, m_socket):
10661070
self.assertRaises(
10671071
OSError, self.loop.run_until_complete, coro)
10681072

1069-
@unittest.skipUnless(IPV6_ENABLED, 'IPv6 not supported or enabled')
1073+
@unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 not supported or enabled')
10701074
def test_create_datagram_endpoint_no_matching_family(self):
10711075
coro = self.loop.create_datagram_endpoint(
10721076
asyncio.DatagramProtocol,

Lib/test/test_asyncio/test_events.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@
2020
import unittest
2121
from unittest import mock
2222
import weakref
23-
from test import support # find_unused_port, IPV6_ENABLED, TEST_HOME_DIR
2423

2524

2625
import asyncio
2726
from asyncio import proactor_events
2827
from asyncio import selector_events
2928
from asyncio import test_utils
29+
try:
30+
from test import support # find_unused_port, IPV6_ENABLED, TEST_HOME_DIR
31+
except ImportError:
32+
from asyncio import test_support as support
3033

3134

3235
def data_file(filename):

Lib/test/test_asyncio/test_futures.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
import sys
66
import threading
77
import unittest
8-
from test import support
98
from unittest import mock
109

1110
import asyncio
1211
from asyncio import test_utils
12+
try:
13+
from test import support # gc_collect
14+
except ImportError:
15+
from asyncio import test_support as support
1316

1417

1518
def _fakefunc(f):

Lib/test/test_asyncio/test_subprocess.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
from asyncio import subprocess
2-
from asyncio import test_utils
3-
import asyncio
41
import signal
52
import sys
63
import unittest
74
from unittest import mock
8-
from test import support
5+
6+
import asyncio
7+
from asyncio import subprocess
8+
from asyncio import test_utils
99
if sys.platform != 'win32':
1010
from asyncio import unix_events
11+
try:
12+
from test import support # PIPE_MAX_SIZE
13+
except ImportError:
14+
from asyncio import test_support as support
1115

1216
# Program blocking
1317
PROGRAM_BLOCKED = [sys.executable, '-c', 'import time; time.sleep(3600)']

Lib/test/test_asyncio/test_tasks.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
import types
77
import unittest
88
import weakref
9-
from test import support
10-
from test.script_helper import assert_python_ok
119
from unittest import mock
10+
try:
11+
from test import support # gc_collect
12+
from test.script_helper import assert_python_ok
13+
except ImportError:
14+
from asyncio import test_support as support
15+
from asyncio.test_support import assert_python_ok
1216

1317
import asyncio
1418
from asyncio import coroutines

Lib/test/test_asyncio/test_windows_utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
import socket
44
import sys
5-
import test.support
65
import unittest
7-
from test.support import IPV6_ENABLED
86
from unittest import mock
97

8+
try:
9+
from test import support # gc_collect, IPV6_ENABLED
10+
except ImportError:
11+
from asyncio import test_support as support
12+
1013
if sys.platform != 'win32':
1114
raise unittest.SkipTest('Windows only')
1215

@@ -28,7 +31,7 @@ def test_winsocketpair(self):
2831
ssock, csock = windows_utils.socketpair()
2932
self.check_winsocketpair(ssock, csock)
3033

31-
@unittest.skipUnless(IPV6_ENABLED, 'IPv6 not supported or enabled')
34+
@unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 not supported or enabled')
3235
def test_winsocketpair_ipv6(self):
3336
ssock, csock = windows_utils.socketpair(family=socket.AF_INET6)
3437
self.check_winsocketpair(ssock, csock)
@@ -114,7 +117,7 @@ def test_pipe_handle(self):
114117

115118
# check garbage collection of p closes handle
116119
del p
117-
test.support.gc_collect()
120+
support.gc_collect()
118121
try:
119122
_winapi.CloseHandle(h)
120123
except OSError as e:

0 commit comments

Comments
 (0)