Skip to content

Commit 4afa45f

Browse files
Use spec tests from git modules as default test targets
1 parent 13363d3 commit 4afa45f

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

tests/runtests.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import unittest
1818
import re
1919
from argparse import ArgumentParser
20+
from pathlib import Path
21+
from typing import List
2022
from unittest import TextTestResult
2123

2224
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'lib'))
@@ -32,9 +34,20 @@
3234
LOCAL_BASES = [
3335
'https://w3c.github.io/json-ld-api/tests',
3436
'https://w3c.github.io/json-ld-framing/tests',
35-
'https://github.com/json-ld/normalization/tests'
37+
'https://w3c.github.io/rdf-canon/tests/',
3638
]
3739

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+
3851
class TestRunner(unittest.TextTestRunner):
3952
"""
4053
Loads test manifests and runs tests.
@@ -95,18 +108,7 @@ def main(self):
95108
test_targets = self.options.tests
96109
else:
97110
# 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()
110112

111113
# ensure a manifest or a directory was specified
112114
if len(test_targets) == 0:

0 commit comments

Comments
 (0)