From b86c039bb32a28525df9afe26154d0e90698cb31 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 19 Mar 2020 16:38:55 +0100 Subject: Add missing labels and a test to prevent this in the future --- wscript | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'wscript') diff --git a/wscript b/wscript index b30239a..10c1682 100644 --- a/wscript +++ b/wscript @@ -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): -- cgit v1.2.1