cpython: bcc77493249c (original) (raw)
Mercurial > cpython
changeset 89995:bcc77493249c
asyncio.tests: Autodiscover asyncio tests. Patch by Vajrasky Kok. Closes #20668 [#20668]
Yury Selivanov yselivanov@sprymix.com | |
---|---|
date | Thu, 27 Mar 2014 12:21:20 -0400 |
parents | 8a4e44473fdd |
children | 3f9a81297b39 |
files | Lib/test/test_asyncio/__init__.py Misc/NEWS |
diffstat | 2 files changed, 13 insertions(+), 12 deletions(-)[+] [-] Lib/test/test_asyncio/__init__.py 22 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Lib/test/test_asyncio/init.py +++ b/Lib/test/test_asyncio/init.py @@ -10,20 +10,18 @@ import_module('concurrent.futures') def suite():
- tests_file = os.path.join(os.path.dirname(file), 'tests.txt')
- with open(tests_file) as fp:
tests = unittest.TestSuite() loader = unittest.TestLoader()test_names = fp.read().splitlines()[](#l1.9)
- for test_name in test_names:
mod_name = 'test.' + test_name[](#l1.13)
try:[](#l1.14)
__import__(mod_name)[](#l1.15)
except unittest.SkipTest:[](#l1.16)
pass[](#l1.17)
else:[](#l1.18)
mod = sys.modules[mod_name][](#l1.19)
tests.addTests(loader.loadTestsFromModule(mod))[](#l1.20)
- for fn in os.listdir(os.path.dirname(file)):
if fn.startswith("test") and fn.endswith(".py"):[](#l1.22)
mod_name = 'test.test_asyncio.' + fn[:-3][](#l1.23)
try:[](#l1.24)
__import__(mod_name)[](#l1.25)
except unittest.SkipTest:[](#l1.26)
pass[](#l1.27)
else:[](#l1.28)
mod = sys.modules[mod_name][](#l1.29)
return teststests.addTests(loader.loadTestsFromModule(mod))[](#l1.30)
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -135,6 +135,9 @@ Tests redirect of http://www.python.org/ to https://www.python.org:[](#l2.4) use http://www.example.com instead. +- Issue #20668: asyncio tests no longer rely on tests.txt file.