diff options
author | David Robillard <d@drobilla.net> | 2020-03-19 16:38:55 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-03-28 17:10:05 +0100 |
commit | b86c039bb32a28525df9afe26154d0e90698cb31 (patch) | |
tree | 780e2ad265735a52d28d7633bdc84df6ae075fdb /wscript | |
parent | 329637e5b3d74ddf2f3f37414158aa83d6f0e873 (diff) | |
download | lv2-b86c039bb32a28525df9afe26154d0e90698cb31.tar.xz |
Add missing labels and a test to prevent this in the future
Diffstat (limited to 'wscript')
-rw-r--r-- | wscript | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -443,6 +443,31 @@ def lint(ctx): "build-test.c") subprocess.call(cmd, cwd='build', shell=True) + +def test_vocabularies(check, files): + import rdflib + + lv2 = rdflib.Namespace('http://lv2plug.in/ns/lv2core#') + owl = rdflib.Namespace('http://www.w3.org/2002/07/owl#') + rdf = rdflib.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#') + rdfs = rdflib.Namespace('http://www.w3.org/2000/01/rdf-schema#') + + model = rdflib.ConjunctiveGraph() + for f in files: + model.parse(f, format='n3') + + # Check that all classes and properties have labels + for t in [rdf.Property, rdfs.Class]: + for r in sorted(model.triples([None, rdf.type, t])): + subject = r[0] + + def has_property(subject, prop): + return model.value(subject, prop, None) is not None + + check(lambda: has_property(subject, rdfs.label), + name = '%s has rdfs:label' % subject) + + def test(tst): import tempfile @@ -464,6 +489,11 @@ def test(tst): all_files = schemas + spec_files + plugin_files + bld_files check(tst.env.SORD_VALIDATE + all_files) + try: + test_vocabularies(check, spec_files) + except ImportError as e: + Logs.warn('Not running vocabulary tests (%s)' % e) + with tst.group('Unit') as check: pattern = tst.env.cprogram_PATTERN % '**/*-test' for test in tst.path.get_bld().ant_glob(pattern): |