]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46425: fix direct invocation of `asyncio` tests (#30725)
authorNikita Sobolev <mail@sobolevn.me>
Sat, 22 Jan 2022 11:06:27 +0000 (14:06 +0300)
committerGitHub <noreply@github.com>
Sat, 22 Jan 2022 11:06:27 +0000 (13:06 +0200)
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 0a5466a0af152beef6ead40d71aedf1feff8d3d3..57b56bba34100b7d10c3716ec7903f80d098294b 100644 (file)
@@ -565,3 +565,7 @@ else:
 
         def create_event_loop(self):
             return asyncio.SelectorEventLoop(selectors.SelectSelector())
+
+
+if __name__ == '__main__':
+    unittest.main()
index ab022a357d205e73d6405a37167df58fc18def7e..448d835b04d5709734e1fa31203c6dd6d2a626f9 100644 (file)
@@ -1,5 +1,4 @@
 import socket
-import time
 import asyncio
 import sys
 import unittest
@@ -512,3 +511,7 @@ else:
 
         def create_event_loop(self):
             return asyncio.SelectorEventLoop(selectors.SelectSelector())
+
+
+if __name__ == '__main__':
+    unittest.main()