|
12 | 12 | from core import Test, PullError
|
13 | 13 |
|
14 | 14 |
|
15 |
| -def load_tests(tests_dir, name): |
| 15 | +def load_tests(config, name): |
16 | 16 | core.log_open_sec(name.capitalize() + " tests")
|
17 |
| - tests_subdir = os.path.join(tests_dir, name) |
| 17 | + tests_subdir = os.path.join(config.get('dirs', 'tests'), name) |
| 18 | + include = [x.strip() for x in config.get('tests', 'include', fallback="").split(',')] |
| 19 | + exclude = [x.strip() for x in config.get('tests', 'exclude', fallback="").split(',')] |
18 | 20 | tests = []
|
19 | 21 | for td in os.listdir(tests_subdir):
|
20 |
| - tests.append(Test(os.path.join(tests_subdir, td), td)) |
| 22 | + test = f'{name}/{td}' |
| 23 | + if test not in exclude and (len(include) == 0 or test in include): |
| 24 | + core.log(f"Adding test {test}") |
| 25 | + tests.append(Test(os.path.join(tests_subdir, td), td)) |
| 26 | + else: |
| 27 | + core.log(f"Skipped test {test}") |
21 | 28 | core.log_end_sec()
|
22 | 29 |
|
23 | 30 | return tests
|
@@ -74,9 +81,10 @@ def run(self) -> None:
|
74 | 81 | os.makedirs(self.result_dir)
|
75 | 82 |
|
76 | 83 | tests_dir = os.path.abspath(core.CORE_DIR + "../../tests")
|
| 84 | + config.set('dirs', 'tests', config.get('dirs', 'tests', fallback=tests_dir)) |
77 | 85 |
|
78 |
| - self.series_tests = load_tests(tests_dir, "series") |
79 |
| - self.patch_tests = load_tests(tests_dir, "patch") |
| 86 | + self.series_tests = load_tests(config, "series") |
| 87 | + self.patch_tests = load_tests(config, "patch") |
80 | 88 | core.log_end_sec()
|
81 | 89 |
|
82 | 90 | while not self.should_die:
|
|
0 commit comments