aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/__init__.py
blob: 23ce5e8059567e050e7d5fe772dd62d89468fee6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import sys
import unittest
from test.support import run_unittest, import_module

# Skip tests if we don't have threading.
import_module('threading')
# Skip tests if we don't have concurrent.futures.
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))
    return tests


def test_main():
    run_unittest(suite())