Skip to content

Commit c96581e

Browse files
Simplify test setup and reorganize test structure
Test organization: - Split tests into unit/ and integration/ folders - Unit tests (test_attribute_type, test_hash, test_settings) run without Docker - Integration tests require MySQL and MinIO services - Update imports to use absolute paths (from tests.schema import ...) Configuration simplification: - Change pytest_env defaults to localhost (was Docker hostnames) - Simplify pixi tasks (env vars now use defaults) - Update devcontainer to set Docker-specific env vars - Update docker-compose comments Tests now run with just: pip install -e ".[test]" docker compose up -d db minio pytest tests/ Unit tests only: pytest tests/unit/ Bump version to 2.0.0a5 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d956288 commit c96581e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+107
-78
lines changed

.devcontainer/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ RUN \
88
pip uninstall datajoint -y
99

1010
USER root
11-
ENV DJ_HOST db
12-
ENV DJ_USER root
13-
ENV DJ_PASS password
11+
ENV DJ_HOST=db
12+
ENV DJ_USER=root
13+
ENV DJ_PASS=password
14+
ENV S3_ENDPOINT=minio:9000

README.md

Lines changed: 40 additions & 33 deletions

docker-compose.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Development environment with MySQL and MinIO services
2-
# Start services: docker-compose up -d db minio
3-
# Run tests: pixi run test
2+
#
3+
# Quick start:
4+
# docker compose up -d db minio # Start services
5+
# pytest tests/ # Run tests (uses localhost defaults)
6+
#
7+
# Full Docker testing:
8+
# docker compose --profile test up djtest --build
49
services:
510
db:
611
image: datajoint/mysql:${MYSQL_VER:-8.0}

pyproject.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ ignore = [
132132
# Per-file ignores (equivalent to flake8 --per-file-ignores)
133133
[tool.ruff.lint.per-file-ignores]
134134
"datajoint/diagram.py" = ["C901"] # function too complex
135-
"tests/test_blob_matlab.py" = ["E501"] # SQL hex strings cannot be broken across lines
135+
"tests/integration/test_blob_matlab.py" = ["E501"] # SQL hex strings cannot be broken across lines
136136

137137
[tool.ruff.lint.mccabe]
138138
# Maximum complexity (equivalent to flake8 --max-complexity)
@@ -160,15 +160,15 @@ ignore-words-list = "rever,numer,astroid"
160160

161161
[tool.pytest_env]
162162
# Default environment variables for tests (D: prefix = only set if not defined)
163-
# When running from host: DJ_HOST=localhost (set via command line or pixi task)
164-
# When running in devcontainer/docker: DJ_HOST=db (docker-compose service name)
165-
"D:DJ_HOST" = "db"
163+
# These defaults work for local development with `docker compose up -d db minio`
164+
# For devcontainer/docker: override DJ_HOST=db and S3_ENDPOINT=minio:9000
165+
"D:DJ_HOST" = "localhost"
166166
"D:DJ_PORT" = "3306"
167167
"D:DJ_USER" = "root"
168168
"D:DJ_PASS" = "password"
169169
"D:DJ_TEST_USER" = "datajoint"
170170
"D:DJ_TEST_PASSWORD" = "datajoint"
171-
"D:S3_ENDPOINT" = "minio:9000"
171+
"D:S3_ENDPOINT" = "localhost:9000"
172172
"D:S3_ACCESS_KEY" = "datajoint"
173173
"D:S3_SECRET_KEY" = "datajoint"
174174
"D:S3_BUCKET" = "datajoint.test"
@@ -188,11 +188,11 @@ test = { features = ["test"], solve-group = "default" }
188188

189189
[tool.pixi.tasks]
190190
# Start required services (MySQL and MinIO)
191-
services-up = "docker-compose up -d db minio"
192-
services-down = "docker-compose down"
193-
# Run tests (requires services to be running)
194-
test = { cmd = "pytest tests/", depends-on = ["services-up"], env = { DJ_HOST = "localhost", DJ_PORT = "3306", S3_ENDPOINT = "localhost:9000" } }
195-
test-cov = { cmd = "pytest --cov-report term-missing --cov=datajoint tests/", depends-on = ["services-up"], env = { DJ_HOST = "localhost", DJ_PORT = "3306", S3_ENDPOINT = "localhost:9000" } }
191+
services-up = "docker compose up -d db minio"
192+
services-down = "docker compose down"
193+
# Run tests (requires services to be running, uses localhost defaults from pytest_env)
194+
test = { cmd = "pytest tests/", depends-on = ["services-up"] }
195+
test-cov = { cmd = "pytest --cov-report term-missing --cov=datajoint tests/", depends-on = ["services-up"] }
196196

197197
[tool.pixi.dependencies]
198198
python = ">=3.10,<3.14"

src/datajoint/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# version bump auto managed by Github Actions:
22
# label_prs.yaml(prep), release.yaml(bump), post_release.yaml(edit)
33
# manually set this version will be eventually overwritten by the above actions
4-
__version__ = "2.0.0a4"
4+
__version__ = "2.0.0a5"

tests/integration/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)