diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py index 6022b95022f7..3d488be1720c 100644 --- a/tests/hazmat/primitives/test_ec.py +++ b/tests/hazmat/primitives/test_ec.py @@ -411,7 +411,9 @@ 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(