|
17 | 17 | import unittest |
18 | 18 | import re |
19 | 19 | from argparse import ArgumentParser |
| 20 | +from pathlib import Path |
20 | 21 | from unittest import TextTestResult |
21 | 22 |
|
22 | 23 | sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'lib')) |
|
32 | 33 | LOCAL_BASES = [ |
33 | 34 | 'https://w3c.github.io/json-ld-api/tests', |
34 | 35 | 'https://w3c.github.io/json-ld-framing/tests', |
35 | | - 'https://github.com/json-ld/normalization/tests' |
| 36 | + 'https://w3c.github.io/rdf-canon/tests/', |
36 | 37 | ] |
37 | 38 |
|
| 39 | + |
| 40 | +def default_test_targets() -> list[Path]: |
| 41 | + """Default test directories from specifications.""" |
| 42 | + specifications = Path(__file__).parent.parent / 'specifications' |
| 43 | + return [ |
| 44 | + specifications / 'json-ld-api/tests', |
| 45 | + specifications / 'json-ld-framing/tests', |
| 46 | + specifications / 'rdf-canon/tests', |
| 47 | + ] |
| 48 | + |
| 49 | + |
38 | 50 | class TestRunner(unittest.TextTestRunner): |
39 | 51 | """ |
40 | 52 | Loads test manifests and runs tests. |
@@ -95,18 +107,7 @@ def main(self): |
95 | 107 | test_targets = self.options.tests |
96 | 108 | else: |
97 | 109 | # default to find known sibling test dirs |
98 | | - test_targets = [] |
99 | | - sibling_dirs = [ |
100 | | - '../json-ld-api/tests/', |
101 | | - '../json-ld-framing/tests/', |
102 | | - '../normalization/tests/', |
103 | | - ] |
104 | | - for dir in sibling_dirs: |
105 | | - if os.path.exists(dir): |
106 | | - print('Test dir found', dir) |
107 | | - test_targets.append(dir) |
108 | | - else: |
109 | | - print('Test dir not found', dir) |
| 110 | + test_targets = default_test_targets() |
110 | 111 |
|
111 | 112 | # ensure a manifest or a directory was specified |
112 | 113 | if len(test_targets) == 0: |
|
0 commit comments