Skip to content

Commit

Permalink
fix import in conftest (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzaslavskiy authored May 31, 2022
1 parent a7bdead commit 361b4a2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@
from fastapi import testclient

import db
from db import SessionLocal

# pylint: disable=wrong-import-position
sys.modules["gpo.database"] = db
from gpo.main import app
from gpo.models import Letter
from gpo import main, models


@pytest.fixture
def generate_data():
"""test fixture"""

def get_letter() -> Letter:
def get_letter() -> models.Letter:
"""get a letter object"""
return Letter(
return models.Letter(
id=5,
name="Name",
address="Address",
Expand All @@ -41,11 +39,11 @@ def get_letter() -> Letter:
@pytest.fixture(scope="session")
def session() -> typing.Generator:
"""session"""
yield SessionLocal()
yield db.SessionLocal()


@pytest.fixture(scope="module")
def client() -> typing.Generator:
"""api test client"""
with testclient.TestClient(app) as test_client:
with testclient.TestClient(main.app) as test_client:
yield test_client

0 comments on commit 361b4a2

Please sign in to comment.