aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-14 18:39:38 +0200
committerDavid Robillard <d@drobilla.net>2020-08-14 19:07:52 +0200
commit3a9bd46a3e02a69052f57741c6778b9ff49664fc (patch)
tree12f73b8859d953e8e2bb6209e5d498a86b12fbc2
parent23fd0f7ff5c1fe3b20d30e095ee05312a2d33880 (diff)
downloadserd-3a9bd46a3e02a69052f57741c6778b9ff49664fc.tar.gz
serd-3a9bd46a3e02a69052f57741c6778b9ff49664fc.tar.bz2
serd-3a9bd46a3e02a69052f57741c6778b9ff49664fc.zip
Factor out test option iterator generation
-rw-r--r--wscript19
1 files changed, 12 insertions, 7 deletions
diff --git a/wscript b/wscript
index 6ed66111..3c7078c9 100644
--- a/wscript
+++ b/wscript
@@ -436,9 +436,18 @@ def _load_rdf(filename):
return model, instances
-def test_suite(ctx, base_uri, testdir, report, isyntax, options=[]):
+def _option_combinations(options):
+ "Return an iterator that cycles through all combinations of options"
import itertools
+ combinations = []
+ for n in range(len(options) + 1):
+ combinations += list(itertools.combinations(options, n))
+
+ return itertools.cycle(combinations)
+
+
+def test_suite(ctx, base_uri, testdir, report, isyntax, options=[]):
srcdir = ctx.path.abspath()
mf = 'http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#'
@@ -450,13 +459,9 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, options=[]):
asserter = 'http://drobilla.net/drobilla#me'
def run_tests(test_class, tests, expected_return):
- thru_flags = [['-e'], ['-f'], ['-b'], ['-r', 'http://example.org/']]
- thru_options = []
- for n in range(len(thru_flags) + 1):
- thru_options += list(itertools.combinations(thru_flags, n))
- thru_options_iter = itertools.cycle(thru_options)
-
+ thru_flags = [['-e'], ['-f'], ['-b'], ['-r', 'http://example.org/']]
osyntax = _test_output_syntax(test_class)
+ thru_options_iter = _option_combinations(thru_flags)
tests_name = '%s.%s' % (testdir, test_class[test_class.find('#') + 1:])
with ctx.group(tests_name) as check:
for test in sorted(tests):