|
1 | 1 | import os |
2 | 2 | from test import support |
3 | | -import unittest |
4 | 3 |
|
5 | 4 | # Skip tests if we don't have concurrent.futures. |
6 | 5 | support.import_module('concurrent.futures') |
7 | 6 |
|
8 | 7 |
|
9 | | -def load_tests(loader, _, pattern): |
| 8 | +def load_tests(*args): |
10 | 9 | pkg_dir = os.path.dirname(__file__) |
11 | | - suite = AsyncioTestSuite() |
12 | | - return support.load_package_tests(pkg_dir, loader, suite, pattern) |
13 | | - |
14 | | - |
15 | | -class AsyncioTestSuite(unittest.TestSuite): |
16 | | - """A custom test suite that also runs setup/teardown for the whole package. |
17 | | -
|
18 | | - Normally unittest only runs setUpModule() and tearDownModule() within each |
19 | | - test module part of the test suite. Copying those functions to each file |
20 | | - would be tedious, let's run this once and for all. |
21 | | - """ |
22 | | - def run(self, result, debug=False): |
23 | | - ignore = support.ignore_deprecations_from |
24 | | - tokens = { |
25 | | - ignore("asyncio.base_events", like=r".*loop argument.*"), |
26 | | - ignore("asyncio.unix_events", like=r".*loop argument.*"), |
27 | | - ignore("asyncio.futures", like=r".*loop argument.*"), |
28 | | - ignore("asyncio.runners", like=r".*loop argument.*"), |
29 | | - ignore("asyncio.subprocess", like=r".*loop argument.*"), |
30 | | - ignore("asyncio.tasks", like=r".*loop argument.*"), |
31 | | - ignore("test.test_asyncio.test_events", like=r".*loop argument.*"), |
32 | | - ignore("test.test_asyncio.test_queues", like=r".*loop argument.*"), |
33 | | - ignore("test.test_asyncio.test_tasks", like=r".*loop argument.*"), |
34 | | - } |
35 | | - try: |
36 | | - super().run(result, debug=debug) |
37 | | - finally: |
38 | | - support.clear_ignored_deprecations(*tokens) |
| 10 | + return support.load_package_tests(pkg_dir, *args) |
0 commit comments