File tree Expand file tree Collapse file tree 2 files changed +9
-20
lines changed Expand file tree Collapse file tree 2 files changed +9
-20
lines changed Original file line number Diff line number Diff line change 21
21
22
22
23
23
MOCK_ANY = mock .ANY
24
- PY34 = sys .version_info >= (3 , 4 )
25
24
26
25
27
26
def tearDownModule ():
@@ -596,18 +595,11 @@ async def zero_error_coro():
596
595
self .loop .run_forever ()
597
596
fut = None # Trigger Future.__del__ or futures._TracebackLogger
598
597
support .gc_collect ()
599
- if PY34 :
600
- # Future.__del__ in Python 3.4 logs error with
601
- # an actual exception context
602
- log .error .assert_called_with (
603
- test_utils .MockPattern ('.*exception was never retrieved' ),
604
- exc_info = (ZeroDivisionError , MOCK_ANY , MOCK_ANY ))
605
- else :
606
- # futures._TracebackLogger logs only textual traceback
607
- log .error .assert_called_with (
608
- test_utils .MockPattern (
609
- '.*exception was never retrieved.*ZeroDiv' ),
610
- exc_info = False )
598
+ # Future.__del__ in Python 3.4 logs error with
599
+ # an actual exception context
600
+ log .error .assert_called_with (
601
+ test_utils .MockPattern ('.*exception was never retrieved' ),
602
+ exc_info = (ZeroDivisionError , MOCK_ANY , MOCK_ANY ))
611
603
612
604
def test_set_exc_handler_invalid (self ):
613
605
with self .assertRaisesRegex (TypeError , 'A callable object or None' ):
Original file line number Diff line number Diff line change @@ -571,13 +571,10 @@ def memory_error():
571
571
test_utils .run_briefly (self .loop )
572
572
support .gc_collect ()
573
573
574
- if sys .version_info >= (3 , 4 ):
575
- regex = f'^{ self .cls .__name__ } exception was never retrieved\n '
576
- exc_info = (type (exc ), exc , exc .__traceback__ )
577
- m_log .error .assert_called_once_with (mock .ANY , exc_info = exc_info )
578
- else :
579
- regex = r'^Future/Task exception was never retrieved\n'
580
- m_log .error .assert_called_once_with (mock .ANY , exc_info = False )
574
+ regex = f'^{ self .cls .__name__ } exception was never retrieved\n '
575
+ exc_info = (type (exc ), exc , exc .__traceback__ )
576
+ m_log .error .assert_called_once_with (mock .ANY , exc_info = exc_info )
577
+
581
578
message = m_log .error .call_args [0 ][0 ]
582
579
self .assertRegex (message , re .compile (regex , re .DOTALL ))
583
580
You can’t perform that action at this time.
0 commit comments