summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lib/asyncio/test_utils.py6
-rw-r--r--Lib/test/test_asyncio/test_selector_events.py8
2 files changed, 9 insertions, 5 deletions
diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py
index d273b08e8f..1505950107 100644
--- a/Lib/asyncio/test_utils.py
+++ b/Lib/asyncio/test_utils.py
@@ -32,6 +32,7 @@ from . import selectors
from . import tasks
from .coroutines import coroutine
from .log import logger
+from test import support
if sys.platform == 'win32': # pragma: no cover
@@ -454,6 +455,7 @@ class TestCase(unittest.TestCase):
def setUp(self):
self._get_running_loop = events._get_running_loop
events._get_running_loop = lambda: None
+ self._thread_cleanup = support.threading_setup()
def tearDown(self):
self.unpatch_get_running_loop()
@@ -464,6 +466,10 @@ class TestCase(unittest.TestCase):
# in an except block of a generator
self.assertEqual(sys.exc_info(), (None, None, None))
+ self.doCleanups()
+ support.threading_cleanup(*self._thread_cleanup)
+ support.reap_children()
+
@contextlib.contextmanager
def disable_logger():
diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py
index 6bf7862ecf..c50b3e4956 100644
--- a/Lib/test/test_asyncio/test_selector_events.py
+++ b/Lib/test/test_asyncio/test_selector_events.py
@@ -24,16 +24,14 @@ MOCK_ANY = mock.ANY
class TestBaseSelectorEventLoop(BaseSelectorEventLoop):
- def close(self):
- # Don't call the close() method of the parent class, because the
- # selector is mocked
- self._closed = True
-
def _make_self_pipe(self):
self._ssock = mock.Mock()
self._csock = mock.Mock()
self._internal_fds += 1
+ def _close_self_pipe(self):
+ pass
+
def list_to_buffer(l=()):
return bytearray().join(l)