-
Notifications
You must be signed in to change notification settings - Fork 92
use pytest to manage docker container startup for tests #1269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use pytest to manage docker container startup for tests #1269
Conversation
|
@dimitri-yatsenko have a look. some tests are failing, which means the services are not exactly configured correctly, but I think this is a promising workflow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the test infrastructure to use pytest fixtures for managing Docker containers (MySQL and MinIO) instead of relying on docker-compose. This enables running tests with a simpler uv sync --group test && pytest tests command and provides better container lifecycle management within the pytest framework.
Key changes:
- Replace docker-compose based test execution with pytest-managed Docker containers
- Add comprehensive Docker container management with proper cleanup mechanisms
- Update test dependencies to use new dependency groups format
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/conftest.py | Adds Docker container fixtures for MySQL and MinIO with lifecycle management |
| tests/test_json.py | Converts module-level MySQL version check to pytest fixture |
| src/datajoint/settings.py | Adds support for DJ_PORT environment variable configuration |
| pyproject.toml | Updates dependency structure and adds test dependencies |
| docker-compose.yaml | Updates comments to reflect new pytest-based testing approach |
| .github/workflows/test.yaml | Simplifies CI workflow to use pytest instead of docker-compose |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
The You can try this with To see the logs related to the standup / shutdown of the docker container images, run |
|
@dimitri-yatsenko it would be great to get tests running as part of CI. Should I open a new ticket for this? |
This change declares the minio and mysql docker services as pytest fixtures, which allows running the test suite without invoking docker-compose.
It also declares a
testdependency group inpyproject.toml, so that tests can be run withuv sync --group test && pytest tests