Skip to content

Commit f4ac1c8

Browse files
committed
TST: pass --random-seed to test runs, and verify that blows when --files and multiple --subjects
1 parent 5f0c089 commit f4ac1c8

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

tests/test_heuristics.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_smoke_converall(tmpdir):
2828
)
2929

3030

31-
@pytest.mark.parametrize('heuristic', [ 'dbic_bids', 'convertall' ])
31+
@pytest.mark.parametrize('heuristic', ['dbic_bids', 'convertall'])
3232
@pytest.mark.parametrize(
3333
'invocation', [
3434
"--files tests/data", # our new way with automated groupping
@@ -38,18 +38,26 @@ def test_smoke_converall(tmpdir):
3838
@pytest.mark.skipif(Dataset is None, reason="no datalad")
3939
def test_dbic_bids_largely_smoke(tmpdir, heuristic, invocation):
4040
is_bids = True if heuristic == 'dbic_bids' else False
41-
arg = "-f heuristics/%s.py -c dcm2niix -o %s" % (heuristic, tmpdir)
41+
arg = "--random-seed 1 -f heuristics/%s.py -c dcm2niix -o %s" % (heuristic, tmpdir)
4242
if is_bids:
4343
arg += " -b"
4444
arg += " --datalad "
4545
args = (
4646
arg + invocation
4747
).split(' ')
48-
if heuristic != 'dbic_bids' and invocation == '--files tests/data':
49-
# none other heuristic has mighty infotoids atm
50-
with pytest.raises(NotImplementedError):
51-
runner(args)
52-
return
48+
49+
# Test some safeguards
50+
if invocation == '--files tests/data':
51+
# Multiple subjects must not be specified -- only a single one could
52+
# be overridden from the command line
53+
with pytest.raises(ValueError):
54+
runner(args + ['--subjects', 'sub1', 'sub2'])
55+
56+
if heuristic != 'dbic_bids':
57+
# none other heuristic has mighty infotoids atm
58+
with pytest.raises(NotImplementedError):
59+
runner(args)
60+
return
5361
runner(args)
5462
ds = Dataset(str(tmpdir))
5563
assert ds.is_installed()

0 commit comments

Comments
 (0)