test_encrypt: remove unreachable assertion (#82570)

We explicitly skip tests in environments where passlib is not available.
pull/82571/head
Martin Krizek 10 months ago committed by GitHub
parent a3e5546e43
commit 853423c270
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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')

Loading…
Cancel
Save