fix: copy over tests/__init__.py on docker build#5443
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Greptile Summary
This PR adds a COPY instruction to the integration test Dockerfile to include all files from the tests directory into the Docker image. Specifically, it copies tests/* to /app/tests/, which ensures that the tests/__init__.py file is available in the container.
The change addresses a Python packaging issue where the tests directory needs an __init__.py file to be properly recognized as a Python package. Without this file, any imports that reference modules in the tests directory would fail with import errors. The existing Dockerfile only copied the tests/integration subdirectory but missed the parent-level files like __init__.py.
This fix integrates with the existing Docker build process for integration tests and ensures the Python package structure is properly maintained in the containerized environment. The glob pattern ./tests/* copies all files (but not subdirectories) from the tests directory, which is the minimal change needed to include the missing __init__.py file.
Confidence score: 4/5
- This PR is safe to merge with minimal risk as it only adds a missing file dependency
- Score reflects the straightforward nature of the fix and low likelihood of breaking existing functionality
- Pay attention to the glob pattern in the COPY instruction to ensure it doesn't include unintended files
1 file reviewed, 1 comment
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="backend/tests/integration/Dockerfile">
<violation number="1" location="backend/tests/integration/Dockerfile:91">
Using COPY ./tests/* will also copy subdirectories (e.g., integration, regression, unit), duplicating integration and bloating the image. Copy only the needed file(s) instead.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
Description
context: https://onyx-company.slack.com/archives/C0771QKDBPE/p1758074441981789
also add braintrust tracing when running braintrust eval locally
How Has This Been Tested?
Running in CI/CD right now
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.
Summary by cubic
Copies top-level test files into the integration test Docker image so tests/init.py is included, fixing import/package discovery issues.