aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-05-05 16:27:53 +0200
committerDavid Robillard <d@drobilla.net>2019-12-20 10:26:55 -0500
commitdd364625e2dda4691cec852a8f4fa3c40ac7e189 (patch)
treebeb78ce3126e0d136865c9757c6da9ffdef0eab9
parent0e7d1a94f992f47048f2a25d2e17e891d40e07ff (diff)
downloadserd-dd364625e2dda4691cec852a8f4fa3c40ac7e189.tar.gz
serd-dd364625e2dda4691cec852a8f4fa3c40ac7e189.tar.bz2
serd-dd364625e2dda4691cec852a8f4fa3c40ac7e189.zip
Factor out test option iterator generation
-rw-r--r--wscript16
1 files changed, 11 insertions, 5 deletions
diff --git a/wscript b/wscript
index 2aefce2d..ae4fe61b 100644
--- a/wscript
+++ b/wscript
@@ -381,6 +381,16 @@ def _file_lines_equal(patha, pathb, subst_from='', subst_to=''):
return True
+def _option_combinations(options):
+ "Return an iterator that cycles through all combinations of the given 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=[]):
import itertools
@@ -396,12 +406,8 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, options=[]):
def run_tests(test_class, tests, expected_return):
thru_flags = [['-e'], ['-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)
-
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):