From ed9958bc1e58895f4d6457ac86d3925e9cddf7a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Mon, 11 Mar 2024 17:49:35 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20code=20structur?= =?UTF-8?q?e=20for=20tests=20(#674)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/routes/login.py | 2 +- backend/app/tests/api/{api_v1 => routes}/__init__.py | 0 backend/app/tests/api/{api_v1 => routes}/test_celery.py | 0 backend/app/tests/api/{api_v1 => routes}/test_items.py | 0 backend/app/tests/api/{api_v1 => routes}/test_login.py | 0 backend/app/tests/api/{api_v1 => routes}/test_users.py | 0 backend/scripts/lint.sh | 1 + backend/tests-start.sh | 3 ++- scripts/test.sh | 1 + 9 files changed, 5 insertions(+), 2 deletions(-) rename backend/app/tests/api/{api_v1 => routes}/__init__.py (100%) rename backend/app/tests/api/{api_v1 => routes}/test_celery.py (100%) rename backend/app/tests/api/{api_v1 => routes}/test_items.py (100%) rename backend/app/tests/api/{api_v1 => routes}/test_login.py (100%) rename backend/app/tests/api/{api_v1 => routes}/test_users.py (100%) diff --git a/backend/app/api/routes/login.py b/backend/app/api/routes/login.py index b2675a2..e4f5a0b 100644 --- a/backend/app/api/routes/login.py +++ b/backend/app/api/routes/login.py @@ -10,7 +10,7 @@ from app.api.deps import CurrentUser, SessionDep, get_current_active_superuser from app.core import security from app.core.config import settings from app.core.security import get_password_hash -from app.models import Message, NewPassword, Token, User, UserOut +from app.models import Message, NewPassword, Token, UserOut from app.utils import ( generate_password_reset_token, generate_reset_password_email, diff --git a/backend/app/tests/api/api_v1/__init__.py b/backend/app/tests/api/routes/__init__.py similarity index 100% rename from backend/app/tests/api/api_v1/__init__.py rename to backend/app/tests/api/routes/__init__.py diff --git a/backend/app/tests/api/api_v1/test_celery.py b/backend/app/tests/api/routes/test_celery.py similarity index 100% rename from backend/app/tests/api/api_v1/test_celery.py rename to backend/app/tests/api/routes/test_celery.py diff --git a/backend/app/tests/api/api_v1/test_items.py b/backend/app/tests/api/routes/test_items.py similarity index 100% rename from backend/app/tests/api/api_v1/test_items.py rename to backend/app/tests/api/routes/test_items.py diff --git a/backend/app/tests/api/api_v1/test_login.py b/backend/app/tests/api/routes/test_login.py similarity index 100% rename from backend/app/tests/api/api_v1/test_login.py rename to backend/app/tests/api/routes/test_login.py diff --git a/backend/app/tests/api/api_v1/test_users.py b/backend/app/tests/api/routes/test_users.py similarity index 100% rename from backend/app/tests/api/api_v1/test_users.py rename to backend/app/tests/api/routes/test_users.py diff --git a/backend/scripts/lint.sh b/backend/scripts/lint.sh index 148d37c..7b0397e 100644 --- a/backend/scripts/lint.sh +++ b/backend/scripts/lint.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash +set -e set -x mypy app diff --git a/backend/tests-start.sh b/backend/tests-start.sh index 53396b6..cbc7d46 100644 --- a/backend/tests-start.sh +++ b/backend/tests-start.sh @@ -1,7 +1,8 @@ #! /usr/bin/env bash set -e +set -x python /app/app/tests_pre_start.py -bash ./scripts/lint.sh +bash ./scripts/lint.sh bash ./scripts/test.sh "$@" diff --git a/scripts/test.sh b/scripts/test.sh index 8e69e23..73c449a 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -2,6 +2,7 @@ # Exit in case of error set -e +set -x docker compose build docker compose down -v --remove-orphans # Remove possibly previous broken stacks left hanging after an error