Skip to content

Commit

Permalink
FIX: add app to python path when running pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
dalmia committed Apr 29, 2022
1 parent 8d96df7 commit 1e51d54
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from .routers import questions, quizzes, session_answers, sessions
from routers import questions, quizzes, session_answers, sessions
from mangum import Mangum

app = FastAPI()
Expand Down
2 changes: 1 addition & 1 deletion app/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional, List, Union
from bson import ObjectId
from pydantic import BaseModel, Field
from .schemas import QuestionType, PyObjectId, NavigationMode, QuizLanguage, QuizType
from schemas import QuestionType, PyObjectId, NavigationMode, QuizLanguage, QuizType


class Image(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions app/routers/questions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fastapi import APIRouter, status, HTTPException
from app.database import client
from app.models import QuestionResponse
from database import client
from models import QuestionResponse


router = APIRouter(prefix="/questions", tags=["Questions"])
Expand Down
4 changes: 2 additions & 2 deletions app/routers/quizzes.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from fastapi import APIRouter, status, HTTPException
from fastapi.responses import JSONResponse
from fastapi.encoders import jsonable_encoder
from app.database import client
from app.models import Quiz, QuizResponse
from database import client
from models import Quiz, QuizResponse

router = APIRouter(prefix="/quiz", tags=["Quiz"])

Expand Down
4 changes: 2 additions & 2 deletions app/routers/session_answers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from fastapi import APIRouter, status, HTTPException
from fastapi.responses import JSONResponse
from fastapi.encoders import jsonable_encoder
from app.database import client
from app.models import SessionAnswerResponse, UpdateSessionAnswer
from database import client
from models import SessionAnswerResponse, UpdateSessionAnswer

router = APIRouter(prefix="/session_answers", tags=["Session Answers"])

Expand Down
4 changes: 2 additions & 2 deletions app/routers/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from fastapi.responses import JSONResponse
from fastapi.encoders import jsonable_encoder
import pymongo
from app.database import client
from app.models import Session, SessionAnswer, SessionResponse
from database import client
from models import Session, SessionAnswer, SessionResponse

router = APIRouter(prefix="/sessions", tags=["Sessions"])

Expand Down
2 changes: 1 addition & 1 deletion app/tests/test_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import unittest
import json
from mongoengine import connect, disconnect
from app.main import app
from main import app

client = TestClient(app)

Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
pythonpath = app

0 comments on commit 1e51d54

Please sign in to comment.