fix: Remove global state (#1216)

* Remove all global settings state

* chore: remove autogenerated class

* chore: cleanup

* chore: merge conflicts
This commit is contained in:
Pablo Orgaz 2023-11-12 22:20:36 +01:00 committed by GitHub
parent f394ca61bb
commit 022bd718e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 286 additions and 190 deletions

View file

@ -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)