add command-line options for Uvicorn server configuration

This commit is contained in:
kstyagi23
2026-09-05 06:15:18 +05:30
parent c4facda5ce
commit 48402f7d61
3 changed files with 83 additions and 5 deletions
+23
View File
@@ -65,3 +65,26 @@ def test_capture_routes_are_scoped_to_the_browser_session(tmp_path, monkeypatch)
stats = client.get("/api/stats")
assert stats.status_code == 200
assert stats.json()["active_crawls"] == 1
def test_run_forwards_server_options_to_uvicorn(monkeypatch) -> None:
calls: list[tuple[tuple[object, ...], dict[str, object]]] = []
def fake_run(*args: object, **kwargs: object) -> None:
calls.append((args, kwargs))
monkeypatch.setattr(main.uvicorn, "run", fake_run)
main.run(["--port", "9123", "--workers", "2"])
assert calls == [
(
("app.main:app",),
{
"host": settings.host,
"port": 9123,
"workers": 2,
"reload": False,
},
)
]