Silence unhandled exceptions in Thread.run() during unit-tests (#1802)

Python 3.8 changed the way how exceptions raised from the Thread.run() method are handled.
It resulted in unit-tests showing a couple of warnings. They are not important and we just silence them.
This commit is contained in:
Alexander Kukushkin
2020-12-16 19:37:51 +01:00
committed by GitHub
parent df9cadcdc4
commit 94b9f8fae6
3 changed files with 5 additions and 0 deletions
+2
View File
@@ -14,6 +14,7 @@ class TestCallbackExecutor(unittest.TestCase):
ce = CallbackExecutor()
ce._kill_children = Mock(side_effect=Exception)
ce._invoke_excepthook = Mock()
self.assertIsNone(ce.call([]))
ce.join()
@@ -30,5 +31,6 @@ class TestCallbackExecutor(unittest.TestCase):
mock_popen.side_effect = Exception
ce = CallbackExecutor()
ce._condition.wait = Mock(side_effect=[None, Exception])
ce._invoke_excepthook = Mock()
self.assertIsNone(ce.call([]))
ce.join()
+1
View File
@@ -110,6 +110,7 @@ class TestDnsCachingResolver(unittest.TestCase):
@patch('socket.getaddrinfo', Mock(side_effect=socket.gaierror))
def test_run(self):
r = DnsCachingResolver()
r._invoke_excepthook = Mock()
self.assertIsNone(r.resolve_async('', 0))
r.join()