]> granicus.if.org Git - python/commitdiff
asyncio: sync with Tulip
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 18 Dec 2014 11:29:53 +0000 (12:29 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 18 Dec 2014 11:29:53 +0000 (12:29 +0100)
Lib/test/test_asyncio/test_base_events.py
Lib/test/test_asyncio/test_events.py
Lib/test/test_asyncio/test_futures.py
Lib/test/test_asyncio/test_subprocess.py
Lib/test/test_asyncio/test_tasks.py
Lib/test/test_asyncio/test_windows_utils.py

index db9d732c1e08f2a6b9ee4300dd2c9695274b294b..4e5b6ca9dfcd647c0821da09b5a5ca6345690910 100644 (file)
@@ -8,13 +8,17 @@ import sys
 import time
 import unittest
 from unittest import mock
-from test.script_helper import assert_python_ok
-from test.support import IPV6_ENABLED, gc_collect
 
 import asyncio
 from asyncio import base_events
 from asyncio import constants
 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
@@ -634,7 +638,7 @@ class BaseEventLoopTests(test_utils.TestCase):
         except KeyboardInterrupt:
             pass
         self.loop.close()
-        gc_collect()
+        support.gc_collect()
 
         self.assertFalse(self.loop.call_exception_handler.called)
 
@@ -1066,7 +1070,7 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
         self.assertRaises(
             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):
         coro = self.loop.create_datagram_endpoint(
             asyncio.DatagramProtocol,
index d7e2f3488d59b5991d84422ecc5ff97b734f9326..063029208aef287097d7643ce2728fa07f1c3ebd 100644 (file)
@@ -20,13 +20,16 @@ import errno
 import unittest
 from unittest import mock
 import weakref
-from test import support  # find_unused_port, IPV6_ENABLED, TEST_HOME_DIR
 
 
 import asyncio
 from asyncio import proactor_events
 from asyncio import selector_events
 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):
index 371d3518ff55ed006e61893a58b228f6c69d55bd..f9c3ad2086c55039d21597ed240cfbe058fff1a9 100644 (file)
@@ -5,11 +5,14 @@ import re
 import sys
 import threading
 import unittest
-from test import support
 from unittest import mock
 
 import asyncio
 from asyncio import test_utils
+try:
+    from test import support   # gc_collect
+except ImportError:
+    from asyncio import test_support as support
 
 
 def _fakefunc(f):
index 5c0a2c85e312074298f483d7c95522bcbb839c37..08c8ac2450e222144e96be64a6e96def8bb414b8 100644 (file)
@@ -1,13 +1,17 @@
-from asyncio import subprocess
-from asyncio import test_utils
-import asyncio
 import signal
 import sys
 import unittest
 from unittest import mock
-from test import support
+
+import asyncio
+from asyncio import subprocess
+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)']
index 770f2181dc37873f77983cc3a2d3e3459b0c778a..25b21dc5ecf5a5e89262d9696fd2728ee1595e5e 100644 (file)
@@ -6,9 +6,13 @@ import sys
 import types
 import unittest
 import weakref
-from test import support
-from test.script_helper import assert_python_ok
 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
index 3e7a211ea747b1a508f629393298ab76c184cc06..b9579491844b1a593393f9eb9ad82c5c86f10c1e 100644 (file)
@@ -2,11 +2,14 @@
 
 import socket
 import sys
-import test.support
 import unittest
-from test.support import IPV6_ENABLED
 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')
 
@@ -28,7 +31,7 @@ class WinsocketpairTests(unittest.TestCase):
         ssock, csock = windows_utils.socketpair()
         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):
         ssock, csock = windows_utils.socketpair(family=socket.AF_INET6)
         self.check_winsocketpair(ssock, csock)
@@ -114,7 +117,7 @@ class PipeTests(unittest.TestCase):
 
         # check garbage collection of p closes handle
         del p
-        test.support.gc_collect()
+        support.gc_collect()
         try:
             _winapi.CloseHandle(h)
         except OSError as e: