0

I need to structure my fastapi project.

However, regarding testing, I cannot figure out how to propery import files.

This is the structure:

enter image description here

#test_api.py

from fastapi.testclient import TestClient
import os
import pytest
from unittest import mock

from api import app # this line is always red

client = TestClient(app)



Of course running pytest results in a 'module not found' error. What I am doing wrong here?

WorkoutBuddy
  • 389
  • 3
  • 17
  • Please have a look at [this](https://stackoverflow.com/a/71360330/17865804) and [this](https://stackoverflow.com/a/71342222/17865804) answer. – Chris Mar 05 '22 at 18:21

0 Answers0