Skip to content

Commit 5d5f5e6

Browse files
committed
tst: improve coverage
1 parent 63d08ac commit 5d5f5e6

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

nitransforms/tests/test_cli.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55
from ..cli import cli_apply, main as ntcli
66

77

8-
def test_cli():
8+
def test_cli(capsys):
99
# empty command
1010
with pytest.raises(SystemExit):
1111
ntcli()
1212
# invalid command
1313
with pytest.raises(SystemExit):
1414
ntcli(['idk'])
1515

16-
17-
def test_help(capsys):
1816
with pytest.raises(SystemExit) as sysexit:
1917
ntcli(['-h'])
2018
console = capsys.readouterr()
@@ -26,23 +24,27 @@ def test_help(capsys):
2624
ntcli(['apply', '-h'])
2725
console = capsys.readouterr()
2826
assert dedent(cli_apply.__doc__) in console.out
27+
assert sysexit.value.code == 0
2928

3029

3130
def test_apply_linear(tmpdir, data_path, get_testdata):
3231
tmpdir.chdir()
3332
img = 'img.nii.gz'
3433
get_testdata['RAS'].to_filename(img)
3534
lin_xform = str(data_path / 'affine-RAS.itk.tfm')
35+
lin_xform2 = str(data_path / 'affine-RAS.fs.lta')
3636

3737
# unknown transformation format
3838
with pytest.raises(ValueError):
3939
ntcli(['apply', 'unsupported.xform', 'img.nii.gz'])
4040

4141
# linear transform arguments
42-
largs = ['apply', lin_xform, img, '--ref', img]
43-
ntcli(largs)
44-
output = 'nt_img.nii.gz'
45-
assert (tmpdir / output).check()
42+
output = tmpdir / 'nt_img.nii.gz'
43+
ntcli(['apply', lin_xform, img, '--ref', img])
44+
assert output.check()
45+
output.remove()
46+
ntcli(['apply', lin_xform2, img, '--ref', img])
47+
assert output.check()
4648

4749

4850
def test_apply_nl(tmpdir, data_path):

0 commit comments

Comments
 (0)