mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 07:40:12 +01:00
fix: Remove global state (#1216)
* Remove all global settings state * chore: remove autogenerated class * chore: cleanup * chore: merge conflicts
This commit is contained in:
parent
f394ca61bb
commit
022bd718e3
24 changed files with 286 additions and 190 deletions
15
tests/fixtures/fast_api_test_client.py
vendored
15
tests/fixtures/fast_api_test_client.py
vendored
|
|
@ -1,15 +1,14 @@
|
|||
import pytest
|
||||
from fastapi import FastAPI
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from private_gpt.main import app
|
||||
from private_gpt.launcher import create_app
|
||||
from tests.fixtures.mock_injector import MockInjector
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def current_test_app() -> FastAPI:
|
||||
return app
|
||||
def test_client(request: pytest.FixtureRequest, injector: MockInjector) -> TestClient:
|
||||
if request is not None and hasattr(request, "param"):
|
||||
injector.bind_settings(request.param or {})
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def test_client() -> TestClient:
|
||||
return TestClient(app)
|
||||
app_under_test = create_app(injector.test_injector)
|
||||
return TestClient(app_under_test)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue