|
17 | 17 | import unittest
|
18 | 18 | import re
|
19 | 19 | from argparse import ArgumentParser
|
| 20 | +from pathlib import Path |
| 21 | +from typing import List |
20 | 22 | from unittest import TextTestResult
|
21 | 23 |
|
22 | 24 | sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'lib'))
|
|
32 | 34 | LOCAL_BASES = [
|
33 | 35 | 'https://w3c.github.io/json-ld-api/tests',
|
34 | 36 | 'https://w3c.github.io/json-ld-framing/tests',
|
35 |
| - 'https://github.com/json-ld/normalization/tests' |
| 37 | + 'https://w3c.github.io/rdf-canon/tests/', |
36 | 38 | ]
|
37 | 39 |
|
| 40 | + |
| 41 | +def default_test_targets() -> List[Path]: |
| 42 | + """Default test directories from specifications.""" |
| 43 | + specifications = Path(__file__).parent.parent / 'specifications' |
| 44 | + return [ |
| 45 | + specifications / 'json-ld-api/tests', |
| 46 | + specifications / 'json-ld-framing/tests', |
| 47 | + specifications / 'rdf-canon/tests', |
| 48 | + ] |
| 49 | + |
| 50 | + |
38 | 51 | class TestRunner(unittest.TextTestRunner):
|
39 | 52 | """
|
40 | 53 | Loads test manifests and runs tests.
|
@@ -95,18 +108,7 @@ def main(self):
|
95 | 108 | test_targets = self.options.tests
|
96 | 109 | else:
|
97 | 110 | # 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) |
| 111 | + test_targets = default_test_targets() |
110 | 112 |
|
111 | 113 | # ensure a manifest or a directory was specified
|
112 | 114 | if len(test_targets) == 0:
|
|
0 commit comments