test_fastapi_cli.py — fastapi Source File
Architecture documentation for test_fastapi_cli.py, a python file in the fastapi codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 162d1250_3ff3_7651_fde5_eac35024692a["test_fastapi_cli.py"] af9b440f_13c4_d91e_f8ae_bfe199b060d2["os"] 162d1250_3ff3_7651_fde5_eac35024692a --> af9b440f_13c4_d91e_f8ae_bfe199b060d2 c16959b6_d471_41f8_1c0e_2c4fe324727a["subprocess"] 162d1250_3ff3_7651_fde5_eac35024692a --> c16959b6_d471_41f8_1c0e_2c4fe324727a 65099b90_26c1_5db5_09e6_30dc0ea421e3["sys"] 162d1250_3ff3_7651_fde5_eac35024692a --> 65099b90_26c1_5db5_09e6_30dc0ea421e3 d1bf66df_8a92_7a7c_dab4_0865060effa4["unittest.mock"] 162d1250_3ff3_7651_fde5_eac35024692a --> d1bf66df_8a92_7a7c_dab4_0865060effa4 f7c0ee07_c45c_e36e_fc33_e71520275df3["cli.py"] 162d1250_3ff3_7651_fde5_eac35024692a --> f7c0ee07_c45c_e36e_fc33_e71520275df3 5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"] 162d1250_3ff3_7651_fde5_eac35024692a --> 5befe8bf_65d1_d058_6b78_4a597a8488e9 style 162d1250_3ff3_7651_fde5_eac35024692a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import os
import subprocess
import sys
from unittest.mock import patch
import fastapi.cli
import pytest
def test_fastapi_cli():
result = subprocess.run(
[
sys.executable,
"-m",
"coverage",
"run",
"-m",
"fastapi",
"dev",
"non_existent_file.py",
],
capture_output=True,
encoding="utf-8",
env={**os.environ, "PYTHONIOENCODING": "utf-8"},
)
assert result.returncode == 1, result.stdout
assert "Path does not exist non_existent_file.py" in result.stdout
def test_fastapi_cli_not_installed():
with patch.object(fastapi.cli, "cli_main", None):
with pytest.raises(RuntimeError) as exc_info:
fastapi.cli.main()
assert "To use the fastapi command, please install" in str(exc_info.value)
Domain
Subdomains
Dependencies
- cli.py
- os
- pytest
- subprocess
- sys
- unittest.mock
Source
Frequently Asked Questions
What does test_fastapi_cli.py do?
test_fastapi_cli.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Routing subdomain.
What functions are defined in test_fastapi_cli.py?
test_fastapi_cli.py defines 2 function(s): test_fastapi_cli, test_fastapi_cli_not_installed.
What does test_fastapi_cli.py depend on?
test_fastapi_cli.py imports 6 module(s): cli.py, os, pytest, subprocess, sys, unittest.mock.
Where is test_fastapi_cli.py in the architecture?
test_fastapi_cli.py is located at tests/test_fastapi_cli.py (domain: FastAPI, subdomain: Routing, directory: tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free