From: Zbigniew Jędrzejewski-Szmek Date: Wed, 9 Aug 2023 10:25:06 +0000 (+0200) Subject: test: use pytest.raises wrapper X-Git-Tag: v255-rc1~775^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4d8c16b1667d32618955d991ca5c28faf6b2fb58;p=thirdparty%2Fsystemd.git test: use pytest.raises wrapper This way we check that the appropriate exception is raised, not just ignore it. Follow-up for e3c04a5c84af5a39794a0a4963bc9916787aa5b4. --- diff --git a/src/ukify/test/test_ukify.py b/src/ukify/test/test_ukify.py index 9a07f3397c4..d56d958d4e0 100755 --- a/src/ukify/test/test_ukify.py +++ b/src/ukify/test/test_ukify.py @@ -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')