diff options
author | David Robillard <d@drobilla.net> | 2019-10-20 23:59:38 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-10-21 01:14:59 +0200 |
commit | e45054876a08760fc3f223defd4297704b8eb170 (patch) | |
tree | e8bf1d9921c0e69d0ba88a789383a167acebdde7 /wscript | |
parent | a43adb1a2bebc3a0f19eccb1b97ca575e72590e1 (diff) | |
download | serd-e45054876a08760fc3f223defd4297704b8eb170.tar.gz serd-e45054876a08760fc3f223defd4297704b8eb170.tar.bz2 serd-e45054876a08760fc3f223defd4297704b8eb170.zip |
Add test that NEWS file is normalised and round-trips to Turtle
Diffstat (limited to 'wscript')
-rw-r--r-- | wscript | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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') |