Home / Function/ get_client() — fastapi Function Reference

get_client() — fastapi Function Reference

Architecture documentation for the get_client() function in test_tutorial002.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  2d272c04_a005_451d_b7d2_8acc3016f089["get_client()"]
  24c45a29_accd_8258_a7da_ddf6ea0170f4["test_tutorial002.py"]
  2d272c04_a005_451d_b7d2_8acc3016f089 -->|defined in| 24c45a29_accd_8258_a7da_ddf6ea0170f4
  61866e2c_2c2a_d5b5_c116_6db4d0a4aca7["clear_sqlmodel()"]
  2d272c04_a005_451d_b7d2_8acc3016f089 -->|calls| 61866e2c_2c2a_d5b5_c116_6db4d0a4aca7
  style 2d272c04_a005_451d_b7d2_8acc3016f089 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_tutorial/test_sql_databases/test_tutorial002.py lines 31–47

def get_client(request: pytest.FixtureRequest):
    clear_sqlmodel()
    # TODO: remove when updating SQL tutorial to use new lifespan API
    with warnings.catch_warnings(record=True):
        warnings.simplefilter("always")
        mod = importlib.import_module(f"docs_src.sql_databases.{request.param}")
        clear_sqlmodel()
        importlib.reload(mod)
    mod.sqlite_url = "sqlite://"
    mod.engine = create_engine(
        mod.sqlite_url, connect_args={"check_same_thread": False}, poolclass=StaticPool
    )

    with TestClient(mod.app) as c:
        yield c
    # Clean up connection explicitly to avoid resource warning
    mod.engine.dispose()

Domain

Subdomains

Frequently Asked Questions

What does get_client() do?
get_client() is a function in the fastapi codebase, defined in tests/test_tutorial/test_sql_databases/test_tutorial002.py.
Where is get_client() defined?
get_client() is defined in tests/test_tutorial/test_sql_databases/test_tutorial002.py at line 31.
What does get_client() call?
get_client() calls 1 function(s): clear_sqlmodel.

Analyze Your Own Codebase

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

Try Supermodel Free