summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2022-01-22 11:06:27 (GMT)
committerGitHub <noreply@github.com>2022-01-22 11:06:27 (GMT)
commit5a5340044ca98cbe6297668d91bccba04b102923 (patch)
tree03c491c4739e24dc09560596fce48deda09a0f46
parent38afeb1a336f0451c0db86df567ef726f49f6438 (diff)
downloadcpython-5a5340044ca98cbe6297668d91bccba04b102923.zip
cpython-5a5340044ca98cbe6297668d91bccba04b102923.tar.gz
cpython-5a5340044ca98cbe6297668d91bccba04b102923.tar.bz2
bpo-46425: fix direct invocation of `asyncio` tests (#30725)
-rw-r--r--Lib/test/test_asyncio/test_context.py4
-rw-r--r--Lib/test/test_asyncio/test_futures2.py4
-rw-r--r--Lib/test/test_asyncio/test_protocols.py4
-rw-r--r--Lib/test/test_asyncio/test_runners.py6
-rw-r--r--Lib/test/test_asyncio/test_sendfile.py4
-rw-r--r--Lib/test/test_asyncio/test_sock_lowlevel.py5
6 files changed, 25 insertions, 2 deletions
diff --git a/Lib/test/test_asyncio/test_context.py b/Lib/test/test_asyncio/test_context.py
index 63b1eb3..6b80721 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 13dbc70..57d2419 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 438111c..d8cde6d 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 b9ae02d..5c06a1a 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 0a5466a..57b56bb 100644
--- a/Lib/test/test_asyncio/test_sendfile.py
+++ b/Lib/test/test_asyncio/test_sendfile.py
@@ -565,3 +565,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 ab022a3..448d835 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
@@ -512,3 +511,7 @@ else:
def create_event_loop(self):
return asyncio.SelectorEventLoop(selectors.SelectSelector())
+
+
+if __name__ == '__main__':
+ unittest.main()