aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-05-05 16:27:53 +0200
committerDavid Robillard <d@drobilla.net>2020-06-21 18:12:04 +0200
commite170dfe1545c33bb54f2b8b6d39c2aff182e96fb (patch)
tree307e0fad9e00c54e95ce5b4d4a68cb31cf5d5542
parentcac9677b810f88ac582a325d230151995c3ec985 (diff)
downloadserd-e170dfe1545c33bb54f2b8b6d39c2aff182e96fb.tar.gz
serd-e170dfe1545c33bb54f2b8b6d39c2aff182e96fb.tar.bz2
serd-e170dfe1545c33bb54f2b8b6d39c2aff182e96fb.zip
Factor out test option iterator generation
-rw-r--r--wscript17
1 files changed, 11 insertions, 6 deletions
diff --git a/wscript b/wscript
index 2bd95c0a..18f6f14a 100644
--- a/wscript
+++ b/wscript
@@ -452,9 +452,18 @@ def _file_lines_equal(patha, pathb, subst_from='', subst_to=''):
return True
-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#'
@@ -467,12 +476,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):