Home / File/ test_app02.py — fastapi Source File

test_app02.py — fastapi Source File

Architecture documentation for test_app02.py, a python file in the fastapi codebase. 3 imports, 0 dependents.

File python FastAPI Applications 3 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  35139fe3_7fd3_0df9_e5c0_d706b17bc3ac["test_app02.py"]
  83e01a9c_50a9_bec9_6f86_8e729106de01["importlib"]
  35139fe3_7fd3_0df9_e5c0_d706b17bc3ac --> 83e01a9c_50a9_bec9_6f86_8e729106de01
  fb2d9376_ca24_f2b2_f130_cc10e9f2e732["types"]
  35139fe3_7fd3_0df9_e5c0_d706b17bc3ac --> fb2d9376_ca24_f2b2_f130_cc10e9f2e732
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  35139fe3_7fd3_0df9_e5c0_d706b17bc3ac --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  style 35139fe3_7fd3_0df9_e5c0_d706b17bc3ac fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import importlib
from types import ModuleType

import pytest
from pytest import MonkeyPatch


@pytest.fixture(
    name="mod_path",
    params=[
        pytest.param("app02_py39"),
        pytest.param("app02_an_py39"),
    ],
)
def get_mod_path(request: pytest.FixtureRequest):
    mod_path = f"docs_src.settings.{request.param}"
    return mod_path


@pytest.fixture(name="main_mod")
def get_main_mod(mod_path: str) -> ModuleType:
    main_mod = importlib.import_module(f"{mod_path}.main")
    return main_mod


@pytest.fixture(name="test_main_mod")
def get_test_main_mod(mod_path: str) -> ModuleType:
    test_main_mod = importlib.import_module(f"{mod_path}.test_main")
    return test_main_mod


def test_settings(main_mod: ModuleType, monkeypatch: MonkeyPatch):
    monkeypatch.setenv("ADMIN_EMAIL", "admin@example.com")
    settings = main_mod.get_settings()
    assert settings.app_name == "Awesome API"
    assert settings.items_per_user == 50


def test_override_settings(test_main_mod: ModuleType):
    test_main_mod.test_app()

Domain

Subdomains

Dependencies

  • importlib
  • pytest
  • types

Frequently Asked Questions

What does test_app02.py do?
test_app02.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Applications subdomain.
What functions are defined in test_app02.py?
test_app02.py defines 5 function(s): get_main_mod, get_mod_path, get_test_main_mod, test_override_settings, test_settings.
What does test_app02.py depend on?
test_app02.py imports 3 module(s): importlib, pytest, types.
Where is test_app02.py in the architecture?
test_app02.py is located at tests/test_tutorial/test_settings/test_app02.py (domain: FastAPI, subdomain: Applications, directory: tests/test_tutorial/test_settings).

Analyze Your Own Codebase

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

Try Supermodel Free