Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Lib/asyncio/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from . import tasks
from .coroutines import coroutine
from .log import logger
from test import support


if sys.platform == 'win32': # pragma: no cover
Expand Down Expand Up @@ -455,6 +456,7 @@ def unpatch_get_running_loop(self):
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()
Expand All @@ -465,6 +467,10 @@ def tearDown(self):
# 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()

if not compat.PY34:
# Python 3.3 compatibility
def subTest(self, *args, **kwargs):
Expand Down
8 changes: 3 additions & 5 deletions Lib/test/test_asyncio/test_selector_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@

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)
Expand Down