]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: use pytest.raises wrapper
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 9 Aug 2023 10:25:06 +0000 (12:25 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 9 Aug 2023 11:56:07 +0000 (13:56 +0200)
This way we check that the appropriate exception is raised,
not just ignore it.

Follow-up for e3c04a5c84af5a39794a0a4963bc9916787aa5b4.

src/ukify/test/test_ukify.py

index 9a07f3397c4698a384ddf462206071b66c2b91f7..d56d958d4e02ead77d4b876d1214fd96a9cbf790 100755 (executable)
@@ -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')