Commit dc7765d1 authored by Victor Stinner's avatar Victor Stinner

asyncio: sync with Tulip

parent 3a1c738e
...@@ -8,13 +8,17 @@ import sys ...@@ -8,13 +8,17 @@ import sys
import time import time
import unittest import unittest
from unittest import mock from unittest import mock
from test.script_helper import assert_python_ok
from test.support import IPV6_ENABLED, gc_collect
import asyncio import asyncio
from asyncio import base_events from asyncio import base_events
from asyncio import constants from asyncio import constants
from asyncio import test_utils 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 MOCK_ANY = mock.ANY
...@@ -634,7 +638,7 @@ class BaseEventLoopTests(test_utils.TestCase): ...@@ -634,7 +638,7 @@ class BaseEventLoopTests(test_utils.TestCase):
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
self.loop.close() self.loop.close()
gc_collect() support.gc_collect()
self.assertFalse(self.loop.call_exception_handler.called) self.assertFalse(self.loop.call_exception_handler.called)
...@@ -1066,7 +1070,7 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase): ...@@ -1066,7 +1070,7 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
self.assertRaises( self.assertRaises(
OSError, self.loop.run_until_complete, coro) OSError, self.loop.run_until_complete, coro)
@unittest.skipUnless(IPV6_ENABLED, 'IPv6 not supported or enabled') @unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 not supported or enabled')
def test_create_datagram_endpoint_no_matching_family(self): def test_create_datagram_endpoint_no_matching_family(self):
coro = self.loop.create_datagram_endpoint( coro = self.loop.create_datagram_endpoint(
asyncio.DatagramProtocol, asyncio.DatagramProtocol,
......
...@@ -20,13 +20,16 @@ import errno ...@@ -20,13 +20,16 @@ import errno
import unittest import unittest
from unittest import mock from unittest import mock
import weakref import weakref
from test import support # find_unused_port, IPV6_ENABLED, TEST_HOME_DIR
import asyncio import asyncio
from asyncio import proactor_events from asyncio import proactor_events
from asyncio import selector_events from asyncio import selector_events
from asyncio import test_utils 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): def data_file(filename):
......
...@@ -5,11 +5,14 @@ import re ...@@ -5,11 +5,14 @@ import re
import sys import sys
import threading import threading
import unittest import unittest
from test import support
from unittest import mock from unittest import mock
import asyncio import asyncio
from asyncio import test_utils from asyncio import test_utils
try:
from test import support # gc_collect
except ImportError:
from asyncio import test_support as support
def _fakefunc(f): def _fakefunc(f):
......
from asyncio import subprocess
from asyncio import test_utils
import asyncio
import signal import signal
import sys import sys
import unittest import unittest
from unittest import mock from unittest import mock
from test import support
import asyncio
from asyncio import subprocess
from asyncio import test_utils
if sys.platform != 'win32': if sys.platform != 'win32':
from asyncio import unix_events 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 blocking
PROGRAM_BLOCKED = [sys.executable, '-c', 'import time; time.sleep(3600)'] PROGRAM_BLOCKED = [sys.executable, '-c', 'import time; time.sleep(3600)']
......
...@@ -6,9 +6,13 @@ import sys ...@@ -6,9 +6,13 @@ import sys
import types import types
import unittest import unittest
import weakref import weakref
from test import support
from test.script_helper import assert_python_ok
from unittest import mock 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 import asyncio
from asyncio import coroutines from asyncio import coroutines
......
...@@ -2,11 +2,14 @@ ...@@ -2,11 +2,14 @@
import socket import socket
import sys import sys
import test.support
import unittest import unittest
from test.support import IPV6_ENABLED
from unittest import mock 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': if sys.platform != 'win32':
raise unittest.SkipTest('Windows only') raise unittest.SkipTest('Windows only')
...@@ -28,7 +31,7 @@ class WinsocketpairTests(unittest.TestCase): ...@@ -28,7 +31,7 @@ class WinsocketpairTests(unittest.TestCase):
ssock, csock = windows_utils.socketpair() ssock, csock = windows_utils.socketpair()
self.check_winsocketpair(ssock, csock) self.check_winsocketpair(ssock, csock)
@unittest.skipUnless(IPV6_ENABLED, 'IPv6 not supported or enabled') @unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 not supported or enabled')
def test_winsocketpair_ipv6(self): def test_winsocketpair_ipv6(self):
ssock, csock = windows_utils.socketpair(family=socket.AF_INET6) ssock, csock = windows_utils.socketpair(family=socket.AF_INET6)
self.check_winsocketpair(ssock, csock) self.check_winsocketpair(ssock, csock)
...@@ -114,7 +117,7 @@ class PipeTests(unittest.TestCase): ...@@ -114,7 +117,7 @@ class PipeTests(unittest.TestCase):
# check garbage collection of p closes handle # check garbage collection of p closes handle
del p del p
test.support.gc_collect() support.gc_collect()
try: try:
_winapi.CloseHandle(h) _winapi.CloseHandle(h)
except OSError as e: except OSError as e:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment