]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46425: fix direct invocation of `asyncio` tests (GH-30725)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 22 Jan 2022 11:54:07 +0000 (03:54 -0800)
committerGitHub <noreply@github.com>
Sat, 22 Jan 2022 11:54:07 +0000 (03:54 -0800)
(cherry picked from commit 5a5340044ca98cbe6297668d91bccba04b102923)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Lib/test/test_asyncio/test_context.py
Lib/test/test_asyncio/test_futures2.py
Lib/test/test_asyncio/test_protocols.py
Lib/test/test_asyncio/test_runners.py
Lib/test/test_asyncio/test_sendfile.py
Lib/test/test_asyncio/test_sock_lowlevel.py

index 63b1eb320ce16b7b749c40fd33ac1969bc10dcef..6b80721873d95cb854906c392f0c627983f1df79 100644 (file)
@@ -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()
index 13dbc703277c814f1336b95184581c8f3bac4aec..57d24190bc0bd5f198a799197a00943436bdf027 100644 (file)
@@ -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()
index 438111cccd34789174fc35564f2c75a0f60e1744..d8cde6d89aadcde0ec31e6172ed2df7e057e4e56 100644 (file)
@@ -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()
index b9ae02dc3c04e096f17f90a7ba741b8714b7793d..5c06a1aaa830fab4c12f00c63cc2176b089544a8 100644 (file)
@@ -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()
index 1b1af08db0a139ff11a1aa678dadda2c27c5f839..28f8de35edd96d0ca790f71c0ed67e8d7691d31e 100644 (file)
@@ -560,3 +560,7 @@ else:
 
         def create_event_loop(self):
             return asyncio.SelectorEventLoop(selectors.SelectSelector())
+
+
+if __name__ == '__main__':
+    unittest.main()
index d8a5df8ede1f844a3fb53259378107950bffa886..7de27b11154a4ea52857ac647ed17e4a9ddb1722 100644 (file)
@@ -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()