Skip to content

Commit e58e2ea

Browse files
MNT: Simplify try/except/else block
Co-authored-by: Chris Markiewicz <[email protected]>
1 parent 0e1dee3 commit e58e2ea

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

nibabel/cmdline/tests/test_roi.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,8 @@ def test_nib_roi_bad_slices(capsys, args, errmsg):
138138
def test_entrypoint(capsys):
139139
# Check that we handle missing args as expected
140140
with mock.patch('sys.argv', ['nib-roi', '--help']):
141-
try:
141+
with pytest.raises(SystemExit):
142142
main()
143-
except SystemExit:
144-
pass
145-
else:
146-
pytest.fail('argparse exits on --help. If changing to another parser, update test.')
147143
captured = capsys.readouterr()
148144
assert captured.out.startswith('usage: nib-roi')
149145

0 commit comments

Comments
 (0)