From 4d8c16b1667d32618955d991ca5c28faf6b2fb58 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 9 Aug 2023 12:25:06 +0200 Subject: [PATCH] test: use pytest.raises wrapper This way we check that the appropriate exception is raised, not just ignore it. Follow-up for e3c04a5c84af5a39794a0a4963bc9916787aa5b4. --- src/ukify/test/test_ukify.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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') -- 2.47.3