Home / Function/ get_test_client() — fastapi Function Reference

get_test_client() — fastapi Function Reference

Architecture documentation for the get_test_client() function in test_app01.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  90512112_06db_2221_2a1a_39b1885b211a["get_test_client()"]
  b6d4ce17_3c8b_e696_67b2_a4ae4858a6c9["test_app01.py"]
  90512112_06db_2221_2a1a_39b1885b211a -->|defined in| b6d4ce17_3c8b_e696_67b2_a4ae4858a6c9
  style 90512112_06db_2221_2a1a_39b1885b211a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_tutorial/test_settings/test_app01.py lines 23–28

def get_test_client(mod_name: str, monkeypatch: MonkeyPatch) -> TestClient:
    if mod_name in sys.modules:
        del sys.modules[mod_name]
    monkeypatch.setenv("ADMIN_EMAIL", "admin@example.com")
    main_mod = importlib.import_module(mod_name)
    return TestClient(main_mod.app)

Domain

Subdomains

Frequently Asked Questions

What does get_test_client() do?
get_test_client() is a function in the fastapi codebase, defined in tests/test_tutorial/test_settings/test_app01.py.
Where is get_test_client() defined?
get_test_client() is defined in tests/test_tutorial/test_settings/test_app01.py at line 23.

Analyze Your Own Codebase

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

Try Supermodel Free