diff options
Diffstat (limited to 'dev-python/uvicorn/files')
-rw-r--r-- | dev-python/uvicorn/files/uvicorn-0.21.1-optional-rust.patch | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/dev-python/uvicorn/files/uvicorn-0.21.1-optional-rust.patch b/dev-python/uvicorn/files/uvicorn-0.21.1-optional-rust.patch new file mode 100644 index 000000000000..dddeda158252 --- /dev/null +++ b/dev-python/uvicorn/files/uvicorn-0.21.1-optional-rust.patch @@ -0,0 +1,80 @@ +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -11,9 +11,13 @@ from time import sleep + from uuid import uuid4 + + import pytest +-import trustme +-from cryptography.hazmat.backends import default_backend +-from cryptography.hazmat.primitives import serialization ++ ++try: ++ import trustme ++ from cryptography.hazmat.backends import default_backend ++ from cryptography.hazmat.primitives import serialization ++except ImportError: ++ pass + + from uvicorn.config import LOGGING_CONFIG + +@@ -30,12 +34,12 @@ LOGGING_CONFIG["loggers"]["uvicorn"]["propagate"] = True + + + @pytest.fixture +-def tls_certificate_authority() -> trustme.CA: ++def tls_certificate_authority() -> "trustme.CA": + return trustme.CA() + + + @pytest.fixture +-def tls_certificate(tls_certificate_authority: trustme.CA) -> trustme.LeafCert: ++def tls_certificate(tls_certificate_authority: "trustme.CA") -> "trustme.LeafCert": + return tls_certificate_authority.issue_cert( + "localhost", + "127.0.0.1", +@@ -44,13 +48,13 @@ def tls_certificate(tls_certificate_authority: trustme.CA) -> trustme.LeafCert: + + + @pytest.fixture +-def tls_ca_certificate_pem_path(tls_certificate_authority: trustme.CA): ++def tls_ca_certificate_pem_path(tls_certificate_authority: "trustme.CA"): + with tls_certificate_authority.cert_pem.tempfile() as ca_cert_pem: + yield ca_cert_pem + + + @pytest.fixture +-def tls_ca_certificate_private_key_path(tls_certificate_authority: trustme.CA): ++def tls_ca_certificate_private_key_path(tls_certificate_authority: "trustme.CA"): + with tls_certificate_authority.private_key_pem.tempfile() as private_key: + yield private_key + +@@ -72,25 +76,25 @@ def tls_certificate_private_key_encrypted_path(tls_certificate): + + + @pytest.fixture +-def tls_certificate_private_key_path(tls_certificate: trustme.CA): ++def tls_certificate_private_key_path(tls_certificate: "trustme.CA"): + with tls_certificate.private_key_pem.tempfile() as private_key: + yield private_key + + + @pytest.fixture +-def tls_certificate_key_and_chain_path(tls_certificate: trustme.LeafCert): ++def tls_certificate_key_and_chain_path(tls_certificate: "trustme.LeafCert"): + with tls_certificate.private_key_and_cert_chain_pem.tempfile() as cert_pem: + yield cert_pem + + + @pytest.fixture +-def tls_certificate_server_cert_path(tls_certificate: trustme.LeafCert): ++def tls_certificate_server_cert_path(tls_certificate: "trustme.LeafCert"): + with tls_certificate.cert_chain_pems[0].tempfile() as cert_pem: + yield cert_pem + + + @pytest.fixture +-def tls_ca_ssl_context(tls_certificate_authority: trustme.CA) -> ssl.SSLContext: ++def tls_ca_ssl_context(tls_certificate_authority: "trustme.CA") -> ssl.SSLContext: + ssl_ctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH) + tls_certificate_authority.configure_trust(ssl_ctx) + return ssl_ctx |