fix(tests): fixed test runtime errors regarding database connection

This commit is contained in:
ribardej
2025-11-11 15:05:44 +01:00
parent 1da927dc07
commit ff9cc712db
2 changed files with 4 additions and 1 deletions

View File

@@ -31,6 +31,8 @@ jobs:
MARIADB_DB: group_project MARIADB_DB: group_project
MARIADB_USER: appuser MARIADB_USER: appuser
MARIADB_PASSWORD: apppass MARIADB_PASSWORD: apppass
# Ensure the application uses MariaDB (async) during tests
DATABASE_URL: mysql+asyncmy://appuser:apppass@127.0.0.1:3306/group_project
steps: steps:
- name: Check out repository code - name: Check out repository code

View File

@@ -19,8 +19,9 @@ def fastapi_app():
return app return app
@pytest.fixture(scope="session") @pytest.fixture(scope="function")
def client(fastapi_app): def client(fastapi_app):
# Function-scoped to avoid leaking loop-bound resources into async tests
return TestClient(fastapi_app, raise_server_exceptions=True) return TestClient(fastapi_app, raise_server_exceptions=True)