summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2014-03-27 16:21:20 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2014-03-27 16:21:20 (GMT)
commit00abf385ac3b4b13aee66cbeb2a33604d8a871f5 (patch)
tree09b5366e9c66b61c43e198e60de4870893565dcc
parent223082fc691024fe2d0fe44322d042a474eb345d (diff)
downloadcpython-00abf385ac3b4b13aee66cbeb2a33604d8a871f5.zip
cpython-00abf385ac3b4b13aee66cbeb2a33604d8a871f5.tar.gz
cpython-00abf385ac3b4b13aee66cbeb2a33604d8a871f5.tar.bz2
asyncio.tests: Autodiscover asyncio tests. Patch by Vajrasky Kok. Closes #20668
-rw-r--r--Lib/test/test_asyncio/__init__.py22
-rw-r--r--Misc/NEWS3
2 files changed, 13 insertions, 12 deletions
diff --git a/Lib/test/test_asyncio/__init__.py b/Lib/test/test_asyncio/__init__.py
index 23ce5e8..82158af 100644
--- 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:
- 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
index 59e6d1c..8f55c63 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -107,6 +107,9 @@ Tests
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
-----------