blob: 82158af77ddcb6b3f44630f4f3d88bbb57c99820 [file] [log] [blame]
Guido van Rossum27b7c7e2013-10-17 13:40:50 -07001import os
2import sys
3import unittest
Guido van Rossum32879052013-11-17 17:00:21 -08004from test.support import run_unittest, import_module
Guido van Rossum27b7c7e2013-10-17 13:40:50 -07005
Guido van Rossum32879052013-11-17 17:00:21 -08006# Skip tests if we don't have threading.
7import_module('threading')
8# Skip tests if we don't have concurrent.futures.
9import_module('concurrent.futures')
Guido van Rossum7058dad2013-10-19 08:47:26 -070010
Guido van Rossum27b7c7e2013-10-17 13:40:50 -070011
12def suite():
Guido van Rossum27b7c7e2013-10-17 13:40:50 -070013 tests = unittest.TestSuite()
14 loader = unittest.TestLoader()
Yury Selivanov00abf382014-03-27 12:21:20 -040015 for fn in os.listdir(os.path.dirname(__file__)):
16 if fn.startswith("test") and fn.endswith(".py"):
17 mod_name = 'test.test_asyncio.' + fn[:-3]
18 try:
19 __import__(mod_name)
20 except unittest.SkipTest:
21 pass
22 else:
23 mod = sys.modules[mod_name]
24 tests.addTests(loader.loadTestsFromModule(mod))
Guido van Rossum27b7c7e2013-10-17 13:40:50 -070025 return tests
26
27
28def test_main():
29 run_unittest(suite())