Skip to content

Commit c84a9fc

Browse files
Use spec tests from git modules as default test targets
1 parent ac97d27 commit c84a9fc

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

tests/runtests.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import unittest
1818
import re
1919
from argparse import ArgumentParser
20+
from pathlib import Path
2021
from unittest import TextTestResult
2122

2223
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'lib'))
@@ -32,9 +33,20 @@
3233
LOCAL_BASES = [
3334
'https://w3c.github.io/json-ld-api/tests',
3435
'https://w3c.github.io/json-ld-framing/tests',
35-
'https://github.com/json-ld/normalization/tests'
36+
'https://w3c.github.io/rdf-canon/tests/',
3637
]
3738

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+
3850
class TestRunner(unittest.TextTestRunner):
3951
"""
4052
Loads test manifests and runs tests.
@@ -95,18 +107,7 @@ def main(self):
95107
test_targets = self.options.tests
96108
else:
97109
# 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()
110111

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

0 commit comments

Comments
 (0)