Home / Function/ nosan_server() — requests Function Reference

nosan_server() — requests Function Reference

Architecture documentation for the nosan_server() function in conftest.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  7be3c87a_63c6_6a4b_1b72_acb57457afbb["nosan_server()"]
  e696bd14_8c3a_2ed9_0573_afe778384f9e["conftest.py"]
  7be3c87a_63c6_6a4b_1b72_acb57457afbb -->|defined in| e696bd14_8c3a_2ed9_0573_afe778384f9e
  style 7be3c87a_63c6_6a4b_1b72_acb57457afbb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/conftest.py lines 36–58

def nosan_server(tmp_path_factory):
    # delay importing until the fixture in order to make it possible
    # to deselect the test via command-line when trustme is not available
    import trustme

    tmpdir = tmp_path_factory.mktemp("certs")
    ca = trustme.CA()
    # only commonName, no subjectAltName
    server_cert = ca.issue_cert(common_name="localhost")
    ca_bundle = str(tmpdir / "ca.pem")
    ca.cert_pem.write_to_path(ca_bundle)

    context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
    server_cert.configure_cert(context)
    server = HTTPServer(("localhost", 0), SimpleHTTPRequestHandler)
    server.socket = context.wrap_socket(server.socket, server_side=True)
    server_thread = threading.Thread(target=server.serve_forever)
    server_thread.start()

    yield "localhost", server.server_address[1], ca_bundle

    server.shutdown()
    server_thread.join()

Domain

Subdomains

Defined In

Frequently Asked Questions

What does nosan_server() do?
nosan_server() is a function in the requests codebase, defined in tests/conftest.py.
Where is nosan_server() defined?
nosan_server() is defined in tests/conftest.py at line 36.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free