From 78bfa8574f6b926da296c5e456f48a37cbdad056 Mon Sep 17 00:00:00 2001 From: NamazovMaksim Date: Tue, 21 Jul 2026 21:35:45 +0300 Subject: [PATCH 1/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=20=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=D0=B0=D1=82=D1=8C?= =?UTF-8?q?=20=D1=82=D0=B5=D1=81=D1=82=D1=8B=20=D0=B8=D0=B7=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=82=D0=B5=D0=B9=D0=BD=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile.test | 17 +++++++++++++++++ Makefile | 14 ++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Dockerfile.test diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 0000000..22db476 --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,17 @@ +FROM python:3.11-slim +ARG APP_VERSION=dev +ENV APP_VERSION=${APP_VERSION} +ENV APP_NAME=modal_backend +ENV APP_MODULE=${APP_NAME}.routes.base:app + +COPY ./requirements.txt ./requirements.dev.txt /${APP_NAME}/ +WORKDIR /${APP_NAME}/ +RUN ["/bin/sh", "-c", "pip install -U -r requirements.txt -r requirements.dev.txt"] +CMD ["-l", "-v"] +ENTRYPOINT ["pytest"] + +COPY ./pyproject.toml /${APP_NAME}/ +COPY ./alembic.ini /${APP_NAME}/ +COPY ./migrations /${APP_NAME}/migrations +COPY ./${APP_NAME} /${APP_NAME}/${APP_NAME} +COPY ./tests /${APP_NAME}/tests/ diff --git a/Makefile b/Makefile index 1284cce..7002f9b 100644 --- a/Makefile +++ b/Makefile @@ -23,3 +23,17 @@ db: migrate: source ./venv/bin/activate && alembic upgrade head + +pytest-container-build: + docker build -f Dockerfile.test -t pytest-container . + +pytest-container-run: + docker run -it \ + -v /var/run/docker.sock:/var/run/docker.sock \ + --rm \ + --add-host host.docker.internal:host-gateway \ + -e TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal \ + --network host \ + pytest-container + + From 61c6dbba2a2434f6556113f878cd91ad542c0531 Mon Sep 17 00:00:00 2001 From: NamazovMaksim Date: Tue, 21 Jul 2026 21:42:01 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D0=B0=20mak?= =?UTF-8?q?e=20pytest-rerun?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Makefile b/Makefile index 7002f9b..d779702 100644 --- a/Makefile +++ b/Makefile @@ -36,4 +36,16 @@ pytest-container-run: --network host \ pytest-container +pytest-rerun: + docker build -f Dockerfile.test -t pytest-container . \ + && \ + docker run -it \ + -v /var/run/docker.sock:/var/run/docker.sock \ + --rm \ + --add-host host.docker.internal:host-gateway \ + -e TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal \ + --network host \ + pytest-container + + From 122e3d6f378fe7c449d32b113ed061db73d50085 Mon Sep 17 00:00:00 2001 From: NamazovMaksim Date: Thu, 23 Jul 2026 20:09:01 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20pytest=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20make?= =?UTF-8?q?=20=D1=81=20=D1=84=D0=BB=D0=B0=D0=B3=D0=B0=D0=BC=D0=B8=20=D1=81?= =?UTF-8?q?=D0=BF=D0=BE=D0=BC=D0=BE=D1=89=D1=8C=D1=8E=20ARGS=3D'-=D1=84=20?= =?UTF-8?q?-=D0=BB=20-=D0=B0=20-=D0=B3=20-=D0=B8'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d779702..04978c3 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,8 @@ pytest-container-run: --add-host host.docker.internal:host-gateway \ -e TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal \ --network host \ - pytest-container + pytest-container \ + $(ARGS) pytest-rerun: docker build -f Dockerfile.test -t pytest-container . \ @@ -45,7 +46,9 @@ pytest-rerun: --add-host host.docker.internal:host-gateway \ -e TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal \ --network host \ - pytest-container + pytest-container \ + $(ARGS) +