[Python-checkins] cpython: asyncio.tests: Autodiscover asyncio tests. Patch by Vajrasky Kok. Closes #20668
yury.selivanov
python-checkins at python.org
Thu Mar 27 17:22:01 CET 2014
http://hg.python.org/cpython/rev/bcc77493249c
changeset: 89995:bcc77493249c
user: Yury Selivanov <yselivanov at sprymix.com>
date: Thu Mar 27 12:21:20 2014 -0400
summary:
asyncio.tests: Autodiscover asyncio tests. Patch by Vajrasky Kok. Closes #20668
files:
Lib/test/test_asyncio/__init__.py | 22 ++++++++----------
Misc/NEWS | 3 ++
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/Lib/test/test_asyncio/__init__.py b/Lib/test/test_asyncio/__init__.py
--- a/Lib/test/test_asyncio/__init__.py
+++ b/Lib/test/test_asyncio/__init__.py
@@ -10,20 +10,18 @@
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()
loader = unittest.TestLoader()
- for test_name in test_names:
- mod_name = 'test.' + test_name
- try:
- __import__(mod_name)
- except unittest.SkipTest:
- pass
- else:
- mod = sys.modules[mod_name]
- tests.addTests(loader.loadTestsFromModule(mod))
+ for fn in os.listdir(os.path.dirname(__file__)):
+ if fn.startswith("test") and fn.endswith(".py"):
+ mod_name = 'test.test_asyncio.' + fn[:-3]
+ try:
+ __import__(mod_name)
+ except unittest.SkipTest:
+ pass
+ else:
+ mod = sys.modules[mod_name]
+ tests.addTests(loader.loadTestsFromModule(mod))
return tests
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -135,6 +135,9 @@
redirect of http://www.python.org/ to https://www.python.org:
use http://www.example.com instead.
+- Issue #20668: asyncio tests no longer rely on tests.txt file.
+ (Patch by Vajrasky Kok)
+
Tools/Demos
-----------
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list