Skip to content

build: keep pytest out of the production backend image - #2

Merged
dzeusking-dev merged 1 commit into
mainfrom
claude/pytest-out-of-prod-image
Oct 30, 2026
Merged

dzeusking-dev merged 1 commit into
mainfrom
claude/pytest-out-of-prod-image

Conversation

@dzeusking-dev

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1. pytest and pytest-asyncio were listed in backend/pyproject.toml [project].dependencies, and backend/Dockerfile runs pip install ., so the test framework shipped in every production image.

  • backend/pyproject.toml: moves both packages to a new [project.optional-dependencies] test extra (pytest>=9.0.3, pytest-asyncio>=0.24.0).
  • backend/Dockerfile: adds ARG INSTALL_TEST_DEPS=false. The image installs .[test] only when it is true, and plain . otherwise.
  • docker-compose.test.yml: passes INSTALL_TEST_DEPS: "true", so the CI image still has pytest for tests/wave5.

docker-compose.yml, docker-compose.clearnet.yml and docker-compose.dashboard.yml are unchanged, so they build with the default false, which gives a production image without pytest. Nothing in backend/app/ imports pytest.

Verification

  • Reproduced the Dockerfile install step locally (only pyproject.toml in the build context, as in the image). pip install . resolves 39 packages and does not include pytest or pytest-asyncio. pip install ".[test]" resolves 45 and includes both.
  • pyproject.toml parses and docker-compose.test.yml parses with the new build arg.
  • CI Build, Migrate & Test: builds the test image through docker-compose.test.yml and runs pytest inside it, which is the end-to-end check for this change.

Generated by Claude Code

pytest and pytest-asyncio were runtime dependencies in
backend/pyproject.toml, so 'pip install .' in backend/Dockerfile shipped
the test framework in every production image.

Move them to an optional 'test' extra and install it only when the
INSTALL_TEST_DEPS build arg is 'true', which docker-compose.test.yml sets
for CI. The production compose files build with the default (false).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016g7tG1VzB5Xnr8GJ7rGDti
@dzeusking-dev
dzeusking-dev marked this pull request as ready for review October 30, 2026 18:32
@dzeusking-dev
dzeusking-dev merged commit b1f844e into main Oct 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant