Repository navigation
build: keep pytest out of the production backend image - #2
Merged
Merged
Conversation
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
marked this pull request as ready for review
October 30, 2026 18:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1.
pytestandpytest-asynciowere listed inbackend/pyproject.toml[project].dependencies, andbackend/Dockerfilerunspip install ., so the test framework shipped in every production image.backend/pyproject.toml: moves both packages to a new[project.optional-dependencies] testextra (pytest>=9.0.3,pytest-asyncio>=0.24.0).backend/Dockerfile: addsARG INSTALL_TEST_DEPS=false. The image installs.[test]only when it istrue, and plain.otherwise.docker-compose.test.yml: passesINSTALL_TEST_DEPS: "true", so the CI image still has pytest fortests/wave5.docker-compose.yml,docker-compose.clearnet.ymlanddocker-compose.dashboard.ymlare unchanged, so they build with the defaultfalse, which gives a production image without pytest. Nothing inbackend/app/imports pytest.Verification
pyproject.tomlin 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.tomlparses anddocker-compose.test.ymlparses with the new build arg.Build, Migrate & Test: builds the test image throughdocker-compose.test.ymland runs pytest inside it, which is the end-to-end check for this change.Generated by Claude Code