From cc3df8e1ffeacfeb7ba89f1134d3b579f01b5cc9 Mon Sep 17 00:00:00 2001 From: Nicola Tuveri Date: Mon, 21 Nov 2022 17:57:35 +0200 Subject: [PATCH] Update invalid EC key test for compatibility with upcoming OpenSSL changes One of the tests checking behavior with invalid EC keys hardcoded the error reason. This commit replaces the string matching with a regex to match both the current string and a new reason, introduced by upcoming OpenSSL changes [0], which would otherwise trigger a false positive failure. [0]: https://github.com/openssl/openssl/pull/19681 --- tests/hazmat/primitives/test_ec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py index 707d23360743..a594a039d554 100644 --- a/tests/hazmat/primitives/test_ec.py +++ b/tests/hazmat/primitives/test_ec.py @@ -479,7 +479,7 @@ def test_load_invalid_ec_key_from_pem(self, backend): # BoringSSL rejects infinity points before it ever gets to us, so it # uses a more generic error message. match = ( - "infinity" if not backend._lib.CRYPTOGRAPHY_IS_BORINGSSL else None + r'infinity|invalid form' if not backend._lib.CRYPTOGRAPHY_IS_BORINGSSL else None ) with pytest.raises(ValueError, match=match): serialization.load_pem_public_key(