summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-01-25 21:22:18 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-01-25 21:22:18 (GMT)
commit128ee220e21bd4e7eb152396ff24d879f38c5d91 (patch)
treecc445b03c4b76fdec0bab5bb1374826356f7a951 /Lib
parentce8d153b0245d324735cdb72e4267f1dd9e52e1e (diff)
downloadcpython-128ee220e21bd4e7eb152396ff24d879f38c5d91.zip
cpython-128ee220e21bd4e7eb152396ff24d879f38c5d91.tar.gz
cpython-128ee220e21bd4e7eb152396ff24d879f38c5d91.tar.bz2
asyncio: Don't export BaseEventLoop, BaseSelectorEventLoop nor
BaseProactorEventLoop Import them from submodules if you really need them.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/asyncio/__init__.py8
-rw-r--r--Lib/test/test_asyncio/test_base_events.py3
-rw-r--r--Lib/test/test_asyncio/test_events.py3
-rw-r--r--Lib/test/test_asyncio/test_proactor_events.py11
-rw-r--r--Lib/test/test_asyncio/test_selector_events.py3
5 files changed, 13 insertions, 15 deletions
diff --git a/Lib/asyncio/__init__.py b/Lib/asyncio/__init__.py
index 95235dc..eb22c38 100644
--- a/Lib/asyncio/__init__.py
+++ b/Lib/asyncio/__init__.py
@@ -18,14 +18,11 @@ if sys.platform == 'win32':
import _overlapped # Will also be exported.
# This relies on each of the submodules having an __all__ variable.
-from .base_events import *
from .events import *
from .futures import *
from .locks import *
-from .proactor_events import *
from .protocols import *
from .queues import *
-from .selector_events import *
from .streams import *
from .tasks import *
from .transports import *
@@ -36,14 +33,11 @@ else:
from .unix_events import * # pragma: no cover
-__all__ = (base_events.__all__ +
- events.__all__ +
+__all__ = (events.__all__ +
futures.__all__ +
locks.__all__ +
- proactor_events.__all__ +
protocols.__all__ +
queues.__all__ +
- selector_events.__all__ +
streams.__all__ +
tasks.__all__ +
transports.__all__)
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
index 8d0796a..9c2bda1 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -9,6 +9,7 @@ import unittest.mock
from test.support import find_unused_port, IPV6_ENABLED
import asyncio
+from asyncio import base_events
from asyncio import constants
from asyncio import test_utils
@@ -16,7 +17,7 @@ from asyncio import test_utils
class BaseEventLoopTests(unittest.TestCase):
def setUp(self):
- self.loop = asyncio.BaseEventLoop()
+ self.loop = base_events.BaseEventLoop()
self.loop._selector = unittest.mock.Mock()
asyncio.set_event_loop(None)
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index 44879ff..bded1a3 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -25,6 +25,7 @@ from test import support # find_unused_port, IPV6_ENABLED, TEST_HOME_DIR
import asyncio
from asyncio import events
+from asyncio import selector_events
from asyncio import test_utils
@@ -902,7 +903,7 @@ class EventLoopTestsMixin:
def test_internal_fds(self):
loop = self.create_event_loop()
- if not isinstance(loop, asyncio.BaseSelectorEventLoop):
+ if not isinstance(loop, selector_events.BaseSelectorEventLoop):
self.skipTest('loop is not a BaseSelectorEventLoop')
self.assertEqual(1, loop._internal_fds)
diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py
index 1c62800..9964f42 100644
--- a/Lib/test/test_asyncio/test_proactor_events.py
+++ b/Lib/test/test_asyncio/test_proactor_events.py
@@ -5,6 +5,7 @@ import unittest
import unittest.mock
import asyncio
+from asyncio.proactor_events import BaseProactorEventLoop
from asyncio.proactor_events import _ProactorSocketTransport
from asyncio.proactor_events import _ProactorWritePipeTransport
from asyncio.proactor_events import _ProactorDuplexPipeTransport
@@ -344,18 +345,18 @@ class BaseProactorEventLoopTests(unittest.TestCase):
self.ssock, self.csock = unittest.mock.Mock(), unittest.mock.Mock()
- class EventLoop(asyncio.BaseProactorEventLoop):
+ class EventLoop(BaseProactorEventLoop):
def _socketpair(s):
return (self.ssock, self.csock)
self.loop = EventLoop(self.proactor)
- @unittest.mock.patch.object(asyncio.BaseProactorEventLoop, 'call_soon')
- @unittest.mock.patch.object(asyncio.BaseProactorEventLoop, '_socketpair')
+ @unittest.mock.patch.object(BaseProactorEventLoop, 'call_soon')
+ @unittest.mock.patch.object(BaseProactorEventLoop, '_socketpair')
def test_ctor(self, socketpair, call_soon):
ssock, csock = socketpair.return_value = (
unittest.mock.Mock(), unittest.mock.Mock())
- loop = asyncio.BaseProactorEventLoop(self.proactor)
+ loop = BaseProactorEventLoop(self.proactor)
self.assertIs(loop._ssock, ssock)
self.assertIs(loop._csock, csock)
self.assertEqual(loop._internal_fds, 1)
@@ -398,7 +399,7 @@ class BaseProactorEventLoopTests(unittest.TestCase):
def test_socketpair(self):
self.assertRaises(
- NotImplementedError, asyncio.BaseProactorEventLoop, self.proactor)
+ NotImplementedError, BaseProactorEventLoop, self.proactor)
def test_make_socket_transport(self):
tr = self.loop._make_socket_transport(self.sock, unittest.mock.Mock())
diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py
index 5a074ae..4c81e75 100644
--- a/Lib/test/test_asyncio/test_selector_events.py
+++ b/Lib/test/test_asyncio/test_selector_events.py
@@ -16,13 +16,14 @@ except ImportError:
import asyncio
from asyncio import selectors
from asyncio import test_utils
+from asyncio.selector_events import BaseSelectorEventLoop
from asyncio.selector_events import _SelectorTransport
from asyncio.selector_events import _SelectorSslTransport
from asyncio.selector_events import _SelectorSocketTransport
from asyncio.selector_events import _SelectorDatagramTransport
-class TestBaseSelectorEventLoop(asyncio.BaseSelectorEventLoop):
+class TestBaseSelectorEventLoop(BaseSelectorEventLoop):
def _make_self_pipe(self):
self._ssock = unittest.mock.Mock()