Commit 00abf385 authored by Yury Selivanov's avatar Yury Selivanov

asyncio.tests: Autodiscover asyncio tests. Patch by Vajrasky Kok. Closes #20668

parent 223082fc
...@@ -10,20 +10,18 @@ import_module('concurrent.futures') ...@@ -10,20 +10,18 @@ import_module('concurrent.futures')
def suite(): def suite():
tests_file = os.path.join(os.path.dirname(__file__), 'tests.txt')
with open(tests_file) as fp:
test_names = fp.read().splitlines()
tests = unittest.TestSuite() tests = unittest.TestSuite()
loader = unittest.TestLoader() loader = unittest.TestLoader()
for test_name in test_names: for fn in os.listdir(os.path.dirname(__file__)):
mod_name = 'test.' + test_name if fn.startswith("test") and fn.endswith(".py"):
try: mod_name = 'test.test_asyncio.' + fn[:-3]
__import__(mod_name) try:
except unittest.SkipTest: __import__(mod_name)
pass except unittest.SkipTest:
else: pass
mod = sys.modules[mod_name] else:
tests.addTests(loader.loadTestsFromModule(mod)) mod = sys.modules[mod_name]
tests.addTests(loader.loadTestsFromModule(mod))
return tests return tests
......
...@@ -107,6 +107,9 @@ Tests ...@@ -107,6 +107,9 @@ Tests
redirect of http://www.python.org/ to https://www.python.org: redirect of http://www.python.org/ to https://www.python.org:
use http://www.example.com instead. use http://www.example.com instead.
- Issue #20668: asyncio tests no longer rely on tests.txt file.
(Patch by Vajrasky Kok)
Tools/Demos Tools/Demos
----------- -----------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment