Skip to content
Myr

Inline SERVER_SCOPE and remove typing_extensions requirement (#1773)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michał Górny · committed by GitHub · parent b839478 · Browse files · 1 file+8 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−12 removed

  • tests:+8 added−12 removed

1 file+8 added−12 removed

modified:tests/conftest.py+8 added-12 removed
12 unmodified lines
13 Encoding,14 PrivateFormat,15 load_pem_private_key,16)17from typing_extensions import Literal17from uvicorn.config import Config18from uvicorn.main import Server1920from httpx import URL
142 unmodified lines
163 )164 await send({"type": "http.response.body"})165166168SERVER_SCOPE: Literal["session"] = "session"169170171@pytest.fixture(scope=SERVER_SCOPE)167@pytest.fixture(scope="session")168def cert_authority():169 return trustme.CA()170171176@pytest.fixture(scope=SERVER_SCOPE)172@pytest.fixture(scope="session")173def ca_cert_pem_file(cert_authority):174 with cert_authority.cert_pem.tempfile() as tmp:175 yield tmp176177182@pytest.fixture(scope=SERVER_SCOPE)178@pytest.fixture(scope="session")179def localhost_cert(cert_authority):180 return cert_authority.issue_cert("localhost")181182187@pytest.fixture(scope=SERVER_SCOPE)183@pytest.fixture(scope="session")184def cert_pem_file(localhost_cert):185 with localhost_cert.cert_chain_pems[0].tempfile() as tmp:186 yield tmp187188193@pytest.fixture(scope=SERVER_SCOPE)189@pytest.fixture(scope="session")190def cert_private_key_file(localhost_cert):191 with localhost_cert.private_key_pem.tempfile() as tmp:192 yield tmp193194199@pytest.fixture(scope=SERVER_SCOPE)195@pytest.fixture(scope="session")196def cert_encrypted_private_key_file(localhost_cert):197 # Deserialize the private key and then reserialize with a password198 private_key = load_pem_private_key(199 localhost_cert.private_key_pem.bytes(), password=None, backend=default_backend()
67 unmodified lines
267 server.should_exit = True268 thread.join()269270275@pytest.fixture(scope=SERVER_SCOPE)271@pytest.fixture(scope="session")272def server():273 config = Config(app=app, lifespan="off", loop="asyncio")274 server = TestServer(config=config)275 yield from serve_in_thread(server)276277282@pytest.fixture(scope=SERVER_SCOPE)278@pytest.fixture(scope="session")279def https_server(cert_pem_file, cert_private_key_file):280 config = Config(281 app=app,282 lifespan="off",
7 unmodified lines