Skip to content

Commit 41ca280

Browse files
YuriiMotovalejsdev
authored andcommitted
🚚 Move backend tests outside the app directory (fastapi#1862)
Co-authored-by: Alejandra <[email protected]>
1 parent 0102883 commit 41ca280

20 files changed

+13
-12
lines changed

backend/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ COPY ./scripts /app/scripts
3434
COPY ./pyproject.toml ./uv.lock ./alembic.ini /app/
3535

3636
COPY ./app /app/app
37+
COPY ./tests /app/tests
3738

3839
# Sync the project
3940
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers

backend/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ To test the backend run:
9797
$ bash ./scripts/test.sh
9898
```
9999

100-
The tests run with Pytest, modify and add tests to `./backend/app/tests/`.
100+
The tests run with Pytest, modify and add tests to `./backend/tests/`.
101101

102102
If you use GitHub Actions the tests will run automatically.
103103

backend/scripts/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
set -e
44
set -x
55

6-
coverage run -m pytest
6+
coverage run -m pytest tests/
77
coverage report
88
coverage html --title "${@-coverage}"
File renamed without changes.
File renamed without changes.
File renamed without changes.

backend/app/tests/api/routes/test_items.py renamed to backend/tests/api/routes/test_items.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from sqlmodel import Session
55

66
from app.core.config import settings
7-
from app.tests.utils.item import create_random_item
7+
from tests.utils.item import create_random_item
88

99

1010
def test_create_item(

backend/app/tests/api/routes/test_login.py renamed to backend/tests/api/routes/test_login.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
from app.core.security import verify_password
88
from app.crud import create_user
99
from app.models import UserCreate
10-
from app.tests.utils.user import user_authentication_headers
11-
from app.tests.utils.utils import random_email, random_lower_string
1210
from app.utils import generate_password_reset_token
11+
from tests.utils.user import user_authentication_headers
12+
from tests.utils.utils import random_email, random_lower_string
1313

1414

1515
def test_get_access_token(client: TestClient) -> None:
File renamed without changes.

backend/app/tests/api/routes/test_users.py renamed to backend/tests/api/routes/test_users.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from app.core.config import settings
99
from app.core.security import verify_password
1010
from app.models import User, UserCreate
11-
from app.tests.utils.utils import random_email, random_lower_string
11+
from tests.utils.utils import random_email, random_lower_string
1212

1313

1414
def test_get_users_superuser_me(

0 commit comments

Comments
 (0)