From e45054876a08760fc3f223defd4297704b8eb170 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 20 Oct 2019 23:59:38 +0200 Subject: Add test that NEWS file is normalised and round-trips to Turtle --- wscript | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'wscript') diff --git a/wscript b/wscript index ca8bd013..6b89706c 100644 --- a/wscript +++ b/wscript @@ -3,6 +3,7 @@ import glob import io import os +import sys from waflib import Logs, Options from waflib.extras import autowaf @@ -444,6 +445,28 @@ def test(tst): check([serdi, 'file://%s/tests/good/manifest.ttl' % srcdir], stdout='/dev/full', name='Write error') + if sys.version_info.major >= 3: + from waflib.extras import autoship + try: + import rdflib + with tst.group('NEWS') as check: + news_path = os.path.join(srcdir, 'NEWS') + entries = autoship.read_news(top=srcdir) + autoship.write_news(entries, 'NEWS.norm') + check.file_equals(news_path, 'NEWS.norm') + + meta_path = os.path.join(srcdir, 'serd.ttl') + autoship.write_news(entries, 'NEWS.ttl', + format='turtle', template=meta_path) + + ttl_entries = autoship.read_news('NEWS.ttl', + top=srcdir, format='turtle') + + autoship.write_news(ttl_entries, 'NEWS.round') + check.file_equals(news_path, 'NEWS.round') + except ImportError: + Logs.warn('Failed to import rdflib, not running NEWS tests') + # Serd-specific test suites serd_base = 'http://drobilla.net/sw/serd/tests/' test_suite(tst, serd_base + 'good/', 'good', None, 'Turtle') -- cgit v1.2.1