use pytest to manage docker container startup for tests#1269
use pytest to manage docker container startup for tests#1269dimitri-yatsenko merged 11 commits intodatajoint:pre/v2.0from
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.
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