Skip to content

Commit 6b23fc6

Browse files
committed
BLD: process commas in the scons tests variable.
Patterns in scons `tests` variable can now be comma or space separated. Ignore the `tests` pattern when empty, i.e., do all unit tests.
1 parent b92b42e commit 6b23fc6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/tests/SConscript

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@ def srcincluded(f):
3030
fl = str(f).lower()
3131
rv = srcsupported(f)
3232
rv = rv and f.srcnode().isfile()
33-
if env_test.get('tests') is not None:
34-
rv = rv and any(t.lower() in fl
35-
for t in Split(env_test['tests']))
33+
if env_test.get('tests'):
34+
tpatterns = Split(env_test['tests'].lower().replace(',', ' '))
35+
rv = rv and any(tp in fl for tp in tpatterns)
3636
return rv
3737

3838
# alltests -- the unit test driver source files
39-
test_sources = filter(srcincluded, GlobSources('Test*.hpp'))
39+
test_sources = [f for f in GlobSources('Test*.hpp') if srcincluded(f)]
40+
if not test_sources:
41+
ts = env_test.get('tests', '')
42+
print("Cannot find any test matching 'tests={}'.".format(ts))
43+
Exit(1)
4044

4145
# Define the DIFFPYTESTSDIRPATH macro required for test_helpers.cpp
4246
thisdir = Dir('.').srcnode().abspath

0 commit comments

Comments
 (0)