Home / Function/ test_server_closes() — requests Function Reference

test_server_closes() — requests Function Reference

Architecture documentation for the test_server_closes() function in test_testserver.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  ce956278_be27_d467_813f_9645ce71ddcd["test_server_closes()"]
  ba85c801_ef4e_5a92_0e3d_07f791306eaf["TestTestServer"]
  ce956278_be27_d467_813f_9645ce71ddcd -->|defined in| ba85c801_ef4e_5a92_0e3d_07f791306eaf
  77b5091f_26f5_443a_fd8b_425cdd5ca984["basic_response_server()"]
  ce956278_be27_d467_813f_9645ce71ddcd -->|calls| 77b5091f_26f5_443a_fd8b_425cdd5ca984
  style ce956278_be27_d467_813f_9645ce71ddcd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_testserver.py lines 30–40

    def test_server_closes(self):
        """the server closes when leaving the context manager"""
        with Server.basic_response_server() as (host, port):
            sock = socket.socket()
            sock.connect((host, port))

            sock.close()

        with pytest.raises(socket.error):
            new_sock = socket.socket()
            new_sock.connect((host, port))

Domain

Subdomains

Frequently Asked Questions

What does test_server_closes() do?
test_server_closes() is a function in the requests codebase, defined in tests/test_testserver.py.
Where is test_server_closes() defined?
test_server_closes() is defined in tests/test_testserver.py at line 30.
What does test_server_closes() call?
test_server_closes() calls 1 function(s): basic_response_server.

Analyze Your Own Codebase

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

Try Supermodel Free