From 853423c270d8e0ca983cbe77d79e738a228e6c8e Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Fri, 19 Jan 2024 14:37:25 +0100 Subject: [PATCH] test_encrypt: remove unreachable assertion (#82570) We explicitly skip tests in environments where passlib is not available. --- test/units/utils/test_encrypt.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/test/units/utils/test_encrypt.py b/test/units/utils/test_encrypt.py index 4683ce216a8..4683b816b46 100644 --- a/test/units/utils/test_encrypt.py +++ b/test/units/utils/test_encrypt.py @@ -11,14 +11,8 @@ from ansible.utils import encrypt def assert_hash(expected, secret, algorithm, **settings): - assert encrypt.do_encrypt(secret, algorithm, **settings) == expected - if encrypt.PASSLIB_AVAILABLE: - assert encrypt.PasslibHash(algorithm).hash(secret, **settings) == expected - else: - with pytest.raises(AnsibleError) as excinfo: - encrypt.PasslibHash(algorithm).hash(secret, **settings) - assert excinfo.value.args[0] == "passlib must be installed and usable to hash with '%s'" % algorithm + assert encrypt.PasslibHash(algorithm).hash(secret, **settings) == expected @pytest.mark.skipif(not encrypt.PASSLIB_AVAILABLE, reason='passlib must be installed to run this test')