summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_asyncio/test_base_events.py17
-rw-r--r--Lib/test/test_asyncio/test_events.py28
-rw-r--r--Lib/test/test_asyncio/test_futures.py11
3 files changed, 17 insertions, 39 deletions
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
index 3f4c2d8..17e8396 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -21,7 +21,6 @@ from test.support import socket_helper
MOCK_ANY = mock.ANY
-PY34 = sys.version_info >= (3, 4)
def tearDownModule():
@@ -596,18 +595,10 @@ class BaseEventLoopTests(test_utils.TestCase):
self.loop.run_forever()
fut = None # Trigger Future.__del__ or futures._TracebackLogger
support.gc_collect()
- if PY34:
- # Future.__del__ in Python 3.4 logs error with
- # an actual exception context
- log.error.assert_called_with(
- test_utils.MockPattern('.*exception was never retrieved'),
- exc_info=(ZeroDivisionError, MOCK_ANY, MOCK_ANY))
- else:
- # futures._TracebackLogger logs only textual traceback
- log.error.assert_called_with(
- test_utils.MockPattern(
- '.*exception was never retrieved.*ZeroDiv'),
- exc_info=False)
+ # Future.__del__ in logs error with an actual exception context
+ log.error.assert_called_with(
+ test_utils.MockPattern('.*exception was never retrieved'),
+ exc_info=(ZeroDivisionError, MOCK_ANY, MOCK_ANY))
def test_set_exc_handler_invalid(self):
with self.assertRaisesRegex(TypeError, 'A callable object or None'):
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index c46c9dd..a30867e 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -737,14 +737,6 @@ class EventLoopTestsMixin:
@unittest.skipIf(ssl is None, 'No ssl module')
def test_ssl_connect_accepted_socket(self):
- if (sys.platform == 'win32' and
- sys.version_info < (3, 5) and
- isinstance(self.loop, proactor_events.BaseProactorEventLoop)
- ):
- raise unittest.SkipTest(
- 'SSL not supported with proactor event loops before Python 3.5'
- )
-
server_context = test_utils.simple_server_sslcontext()
client_context = test_utils.simple_client_sslcontext()
@@ -2206,17 +2198,15 @@ class HandleTests(test_utils.TestCase):
self.assertRegex(repr(h), regex)
# partial method
- if sys.version_info >= (3, 4):
- method = HandleTests.test_handle_repr
- cb = functools.partialmethod(method)
- filename, lineno = test_utils.get_function_source(method)
- h = asyncio.Handle(cb, (), self.loop)
-
- cb_regex = r'<function HandleTests.test_handle_repr .*>'
- cb_regex = (r'functools.partialmethod\(%s, , \)\(\)' % cb_regex)
- regex = (r'^<Handle %s at %s:%s>$'
- % (cb_regex, re.escape(filename), lineno))
- self.assertRegex(repr(h), regex)
+ method = HandleTests.test_handle_repr
+ cb = functools.partialmethod(method)
+ filename, lineno = test_utils.get_function_source(method)
+ h = asyncio.Handle(cb, (), self.loop)
+
+ cb_regex = r'<function HandleTests.test_handle_repr .*>'
+ cb_regex = fr'functools.partialmethod\({cb_regex}, , \)\(\)'
+ regex = fr'^<Handle {cb_regex} at {re.escape(filename)}:{lineno}>$'
+ self.assertRegex(repr(h), regex)
def test_handle_repr_debug(self):
self.loop.get_debug.return_value = True
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py
index 0c379e0..95983f0 100644
--- a/Lib/test/test_asyncio/test_futures.py
+++ b/Lib/test/test_asyncio/test_futures.py
@@ -571,13 +571,10 @@ class BaseFutureTests:
test_utils.run_briefly(self.loop)
support.gc_collect()
- if sys.version_info >= (3, 4):
- regex = f'^{self.cls.__name__} exception was never retrieved\n'
- exc_info = (type(exc), exc, exc.__traceback__)
- m_log.error.assert_called_once_with(mock.ANY, exc_info=exc_info)
- else:
- regex = r'^Future/Task exception was never retrieved\n'
- m_log.error.assert_called_once_with(mock.ANY, exc_info=False)
+ regex = f'^{self.cls.__name__} exception was never retrieved\n'
+ exc_info = (type(exc), exc, exc.__traceback__)
+ m_log.error.assert_called_once_with(mock.ANY, exc_info=exc_info)
+
message = m_log.error.call_args[0][0]
self.assertRegex(message, re.compile(regex, re.DOTALL))