Add skips for encrypt unit tests for Python 3.13

pull/82493/head
Matt Clay 5 months ago
parent 6e4a5acfbd
commit 71a5212586

@ -36,16 +36,20 @@ def assert_hash(expected, secret, algorithm, **settings):
@pytest.mark.skipif(sys.platform.startswith('darwin'), reason='macOS requires passlib') @pytest.mark.skipif(sys.platform.startswith('darwin'), reason='macOS requires passlib')
def test_passlib_or_crypt(): @pytest.mark.skipif(sys.version_info >= (3, 13), reason='Python <= 3.12 required')
def test_passlib_or_crypt_no_passlib():
with passlib_off(): with passlib_off():
expected = "$5$rounds=5000$12345678$uAZsE3BenI2G.nA8DpTl.9Dc8JiqacI53pEqRr5ppT7" expected = "$5$rounds=5000$12345678$uAZsE3BenI2G.nA8DpTl.9Dc8JiqacI53pEqRr5ppT7"
assert encrypt.passlib_or_crypt("123", "sha256_crypt", salt="12345678", rounds=5000) == expected assert encrypt.passlib_or_crypt("123", "sha256_crypt", salt="12345678", rounds=5000) == expected
def test_passlib_or_crypt():
expected = "$5$12345678$uAZsE3BenI2G.nA8DpTl.9Dc8JiqacI53pEqRr5ppT7" expected = "$5$12345678$uAZsE3BenI2G.nA8DpTl.9Dc8JiqacI53pEqRr5ppT7"
assert encrypt.passlib_or_crypt("123", "sha256_crypt", salt="12345678", rounds=5000) == expected assert encrypt.passlib_or_crypt("123", "sha256_crypt", salt="12345678", rounds=5000) == expected
@pytest.mark.skipif(sys.platform.startswith('darwin'), reason='macOS requires passlib') @pytest.mark.skipif(sys.platform.startswith('darwin'), reason='macOS requires passlib')
@pytest.mark.skipif(sys.version_info >= (3, 13), reason='Python <= 3.12 required')
def test_encrypt_with_rounds_no_passlib(): def test_encrypt_with_rounds_no_passlib():
with passlib_off(): with passlib_off():
assert_hash("$5$rounds=5000$12345678$uAZsE3BenI2G.nA8DpTl.9Dc8JiqacI53pEqRr5ppT7", assert_hash("$5$rounds=5000$12345678$uAZsE3BenI2G.nA8DpTl.9Dc8JiqacI53pEqRr5ppT7",
@ -85,6 +89,7 @@ def test_encrypt_with_rounds():
@pytest.mark.skipif(sys.platform.startswith('darwin'), reason='macOS requires passlib') @pytest.mark.skipif(sys.platform.startswith('darwin'), reason='macOS requires passlib')
@pytest.mark.skipif(sys.version_info >= (3, 13), reason='Python <= 3.12 required')
def test_encrypt_default_rounds_no_passlib(): def test_encrypt_default_rounds_no_passlib():
with passlib_off(): with passlib_off():
assert_hash("$1$12345678$tRy4cXc3kmcfRZVj4iFXr/", assert_hash("$1$12345678$tRy4cXc3kmcfRZVj4iFXr/",
@ -111,6 +116,7 @@ def test_encrypt_default_rounds():
@pytest.mark.skipif(sys.platform.startswith('darwin'), reason='macOS requires passlib') @pytest.mark.skipif(sys.platform.startswith('darwin'), reason='macOS requires passlib')
@pytest.mark.skipif(sys.version_info >= (3, 13), reason='Python <= 3.12 required')
def test_password_hash_filter_no_passlib(): def test_password_hash_filter_no_passlib():
with passlib_off(): with passlib_off():
assert not encrypt.PASSLIB_AVAILABLE assert not encrypt.PASSLIB_AVAILABLE
@ -148,6 +154,7 @@ def test_password_hash_filter_passlib():
@pytest.mark.skipif(sys.platform.startswith('darwin'), reason='macOS requires passlib') @pytest.mark.skipif(sys.platform.startswith('darwin'), reason='macOS requires passlib')
@pytest.mark.skipif(sys.version_info >= (3, 13), reason='Python <= 3.12 required')
def test_do_encrypt_no_passlib(): def test_do_encrypt_no_passlib():
with passlib_off(): with passlib_off():
assert not encrypt.PASSLIB_AVAILABLE assert not encrypt.PASSLIB_AVAILABLE
@ -183,6 +190,7 @@ def test_random_salt():
@pytest.mark.skipif(sys.platform.startswith('darwin'), reason='macOS requires passlib') @pytest.mark.skipif(sys.platform.startswith('darwin'), reason='macOS requires passlib')
@pytest.mark.skipif(sys.version_info >= (3, 13), reason='Python <= 3.12 required')
def test_invalid_crypt_salt(): def test_invalid_crypt_salt():
pytest.raises( pytest.raises(
AnsibleError, AnsibleError,

Loading…
Cancel
Save