test: use pytest.raises wrapper

This way we check that the appropriate exception is raised,
not just ignore it.

Follow-up for e3c04a5c84.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2023-08-09 13:56:07 +02:00
parent ca15b59f1f
commit 4d8c16b166
+1 -3
View File
@@ -144,10 +144,8 @@ def test_apply_config(tmp_path):
assert ns.phase_path_groups == [['enter-initrd:leave-initrd:sysinit:ready:shutdown:final']]
def test_parse_args_minimal():
try:
with pytest.raises(ValueError):
ukify.parse_args([])
except ValueError as e:
print(f'expected failure: {e}')
opts = ukify.parse_args('arg1 arg2'.split())
assert opts.linux == pathlib.Path('arg1')