From ea791d46aa1d0f15c483d424fdddabf8f3b61cb0 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 18 Jul 2020 16:23:14 -0700 Subject: [PATCH] add CI tests that GVPR lib is parseable This does not test addedges, binduce, or histogram that require a command line argument. --- rtest/test_examples.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/rtest/test_examples.py b/rtest/test_examples.py index 993722e02..412795ce4 100644 --- a/rtest/test_examples.py +++ b/rtest/test_examples.py @@ -3,6 +3,7 @@ import os import platform import pytest +import shutil import subprocess def c_compiler(): @@ -32,3 +33,24 @@ def test_compile_example(src): else: subprocess.check_call([cc, '-o', os.devnull, filepath] + ['-l{}'.format(l) for l in libs]) + +@pytest.mark.parametrize('src', ['addrings', 'attr', 'bbox', 'bipart', + 'chkedges', 'clustg', 'collapse', 'cycle', 'deghist', 'delmulti', 'depath', + 'flatten', 'group', 'indent', 'path', 'scale', 'span', 'treetoclust', + 'addranks', 'anon', 'bb', 'chkclusters', 'cliptree', 'col', 'color', + 'dechain', 'deledges', 'delnodes', 'dijkstra', 'get-layers-list', 'knbhd', + 'maxdeg', 'rotate', 'scalexy', 'topon']) +def test_gvpr_example(src): + '''check GVPR can parse the given example''' + + # skip this test if GVPR is unavailable + if shutil.which('gvpr') is None: + pytest.skip('GVPR not available') + + # construct an absolute path to the example + path = os.path.join(os.path.abspath(os.path.dirname(__file__)), + '../cmd/gvpr/lib', src) + + # run GVPR with the given script + with open(os.devnull, 'rt') as nul: + subprocess.check_call(['gvpr', '-f', path], stdin=nul) -- 2.40.0