From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sat, 22 Jan 2022 11:54:07 +0000 (-0800) Subject: bpo-46425: fix direct invocation of `asyncio` tests (GH-30725) X-Git-Tag: v3.9.11~141 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c4a3745b900e748f99e80fc3728b534e857d1ff;p=thirdparty%2FPython%2Fcpython.git bpo-46425: fix direct invocation of `asyncio` tests (GH-30725) (cherry picked from commit 5a5340044ca98cbe6297668d91bccba04b102923) Co-authored-by: Nikita Sobolev --- diff --git a/Lib/test/test_asyncio/test_context.py b/Lib/test/test_asyncio/test_context.py index 63b1eb320ce1..6b80721873d9 100644 --- a/Lib/test/test_asyncio/test_context.py +++ b/Lib/test/test_asyncio/test_context.py @@ -32,3 +32,7 @@ class DecimalContextTest(unittest.TestCase): self.assertEqual(str(r2[0]), '0.333333') self.assertEqual(str(r2[1]), '0.111111') + + +if __name__ == '__main__': + unittest.main() diff --git a/Lib/test/test_asyncio/test_futures2.py b/Lib/test/test_asyncio/test_futures2.py index 13dbc703277c..57d24190bc0b 100644 --- a/Lib/test/test_asyncio/test_futures2.py +++ b/Lib/test/test_asyncio/test_futures2.py @@ -16,3 +16,7 @@ class FutureTests(unittest.IsolatedAsyncioTestCase): # The check for returned string is not very reliable but # exact comparison for the whole string is even weaker. self.assertIn('...', repr(await asyncio.wait_for(func(), timeout=10))) + + +if __name__ == '__main__': + unittest.main() diff --git a/Lib/test/test_asyncio/test_protocols.py b/Lib/test/test_asyncio/test_protocols.py index 438111cccd34..d8cde6d89aad 100644 --- a/Lib/test/test_asyncio/test_protocols.py +++ b/Lib/test/test_asyncio/test_protocols.py @@ -55,3 +55,7 @@ class ProtocolsAbsTests(unittest.TestCase): self.assertIsNone(sp.pipe_connection_lost(1, f)) self.assertIsNone(sp.process_exited()) self.assertFalse(hasattr(sp, '__dict__')) + + +if __name__ == '__main__': + unittest.main() diff --git a/Lib/test/test_asyncio/test_runners.py b/Lib/test/test_asyncio/test_runners.py index b9ae02dc3c04..5c06a1aaa830 100644 --- a/Lib/test/test_asyncio/test_runners.py +++ b/Lib/test/test_asyncio/test_runners.py @@ -2,7 +2,7 @@ import asyncio import unittest from unittest import mock -from . import utils as test_utils +from test.test_asyncio import utils as test_utils class TestPolicy(asyncio.AbstractEventLoopPolicy): @@ -180,3 +180,7 @@ class RunTests(BaseTest): self.assertIsNone(spinner.ag_frame) self.assertFalse(spinner.ag_running) + + +if __name__ == '__main__': + unittest.main() diff --git a/Lib/test/test_asyncio/test_sendfile.py b/Lib/test/test_asyncio/test_sendfile.py index 1b1af08db0a1..28f8de35edd9 100644 --- a/Lib/test/test_asyncio/test_sendfile.py +++ b/Lib/test/test_asyncio/test_sendfile.py @@ -560,3 +560,7 @@ else: def create_event_loop(self): return asyncio.SelectorEventLoop(selectors.SelectSelector()) + + +if __name__ == '__main__': + unittest.main() diff --git a/Lib/test/test_asyncio/test_sock_lowlevel.py b/Lib/test/test_asyncio/test_sock_lowlevel.py index d8a5df8ede1f..7de27b11154a 100644 --- a/Lib/test/test_asyncio/test_sock_lowlevel.py +++ b/Lib/test/test_asyncio/test_sock_lowlevel.py @@ -1,5 +1,4 @@ import socket -import time import asyncio import sys import unittest @@ -508,3 +507,7 @@ else: def create_event_loop(self): return asyncio.SelectorEventLoop(selectors.SelectSelector()) + + +if __name__ == '__main__': + unittest.main()