Skip to content

Commit 7fae5d8

Browse files
committed
Database session gets reset every test, so the FastAPI test client that uses the session as a dependency has to be regenerated every test too
1 parent 00fe67f commit 7fae5d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/server/api/test_movies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from unittest.mock import ANY
22

3+
import pytest
34
from fastapi.testclient import TestClient
4-
from pytest import fixture
55
from sqlmodel import Session
66

77
from murfey.server.api.auth import validate_instrument_token
@@ -45,7 +45,7 @@
4545
# app.dependency_overrides[murfey_db] = override_murfey_db
4646

4747

48-
@fixture(scope="module")
48+
@pytest.fixture
4949
def fastapi_client(murfey_db_session):
5050
# Replace the murfey_db instance in endpoint with properly initialised pytest one
5151
app.dependency_overrides[murfey_db] = murfey_db_session

0 commit comments

Comments
 (0)