File tree Expand file tree Collapse file tree 5 files changed +530
-272
lines changed Expand file tree Collapse file tree 5 files changed +530
-272
lines changed Original file line number Diff line number Diff line change 66__pycache__
77subtracted_read_ids.txt
88target
9+ CLAUDE.md
Original file line number Diff line number Diff line change 1+ [tools ]
2+ python = " 3.12"
3+ poetry = " latest"
4+
5+ [tasks .test-setup ]
6+ description = " Build base Docker image for testing"
7+ run = " docker build --target dev -t pathoscope:dev ."
8+
9+ [tasks .test ]
10+ description = " Run tests in Docker"
11+ depends = [" test-setup" ]
12+ run = " ./scripts/test-docker.sh"
13+
14+ [tasks .test-watch ]
15+ description = " Run tests in watch mode"
16+ depends = [" test-setup" ]
17+ run = " ./scripts/test-docker.sh --watch"
18+
19+ [tasks .test-shell ]
20+ description = " Interactive shell in test container"
21+ depends = [" test-setup" ]
22+ run = " ./scripts/test-docker.sh --shell"
23+
24+ [tasks .test-rust ]
25+ description = " Run Rust tests only"
26+ depends = [" test-setup" ]
27+ run = " docker run --rm -v \" $(pwd):/app\" -w /app pathoscope:dev cargo test"
28+
29+ [tasks .test-clean ]
30+ description = " Clean up test Docker resources"
31+ run = " docker rmi pathoscope:dev 2>/dev/null || true"
Original file line number Diff line number Diff line change @@ -51,11 +51,19 @@ COPY --from=poetry /app/.venv /app/.venv
5151COPY --from=poetry /app/python /app/python
5252COPY fixtures.py workflow.py VERSION* ./
5353
54- FROM deps AS test
54+ FROM deps AS dev
5555WORKDIR /app
56- ENV PATH="/root/.local/bin:/root/.cargo/bin:${PATH}"
56+ ENV PATH="/root/.local/bin:/root/.cargo/bin:${PATH}" \
57+ POETRY_CACHE_DIR='/tmp/poetry_cache' \
58+ POETRY_NO_INTERACTION=1 \
59+ POETRY_VIRTUALENVS_IN_PROJECT=1 \
60+ POETRY_VIRTUALENVS_CREATE=1
5761RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
5862RUN curl -sSL https://install.python-poetry.org | python -
63+ # Pre-install common dev tools for faster iterations
64+ RUN pip install pytest-watch
65+
66+ FROM dev AS test
5967COPY Cargo.lock Cargo.toml pyproject.toml poetry.lock ./
6068COPY src ./src
6169COPY python ./python
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -euo pipefail
3+
4+ # Colors for output
5+ GREEN=' \033[0;32m'
6+ BLUE=' \033[0;34m'
7+ YELLOW=' \033[1;33m'
8+ NC=' \033[0m' # No Color
9+
10+ IMAGE_NAME=" pathoscope:dev"
11+ CONTAINER_NAME=" pathoscope-test-$$ "
12+
13+ # Function to cleanup on exit
14+ cleanup () {
15+ if docker ps -q -f name=" $CONTAINER_NAME " | grep -q . ; then
16+ echo -e " ${YELLOW} Cleaning up container...${NC} "
17+ docker rm -f " $CONTAINER_NAME " > /dev/null 2>&1 || true
18+ fi
19+ }
20+
21+ # Set trap to cleanup on script exit
22+ trap cleanup EXIT INT TERM
23+
24+ # Check if image exists, build if not
25+ if ! docker image inspect " $IMAGE_NAME " > /dev/null 2>&1 ; then
26+ echo -e " ${BLUE} Building dev image...${NC} "
27+ docker build --target dev -t " $IMAGE_NAME " .
28+ fi
29+
30+ # Parse command line arguments
31+ MODE=" test"
32+ PYTEST_ARGS=" "
33+
34+ while [[ $# -gt 0 ]]; do
35+ case $1 in
36+ --watch)
37+ MODE=" watch"
38+ shift
39+ ;;
40+ --shell)
41+ MODE=" shell"
42+ shift
43+ ;;
44+ * )
45+ PYTEST_ARGS=" $PYTEST_ARGS $1 "
46+ shift
47+ ;;
48+ esac
49+ done
50+
51+ case $MODE in
52+ " shell" )
53+ echo -e " ${GREEN} Starting interactive shell...${NC} "
54+ docker run -it --rm \
55+ --name " $CONTAINER_NAME " \
56+ -v " $( pwd) :/app" \
57+ -w /app \
58+ " $IMAGE_NAME " \
59+ bash
60+ ;;
61+ " watch" )
62+ echo -e " ${GREEN} Starting test watch mode...${NC} "
63+ docker run -it --rm \
64+ --name " $CONTAINER_NAME " \
65+ -v " $( pwd) :/app" \
66+ -w /app \
67+ " $IMAGE_NAME " \
68+ bash -c " poetry install --no-root && poetry run maturin develop --release && poetry run pytest-watch$PYTEST_ARGS "
69+ ;;
70+ " test" )
71+ echo -e " ${GREEN} Running tests...${NC} "
72+ docker run --rm \
73+ --name " $CONTAINER_NAME " \
74+ -v " $( pwd) :/app" \
75+ -w /app \
76+ " $IMAGE_NAME " \
77+ bash -c " echo 'Running Rust tests...' && cargo test && echo 'Running Python tests...' && poetry install --no-root && poetry run maturin develop --release && poetry run pytest$PYTEST_ARGS "
78+ ;;
79+ esac
You can’t perform that action at this time.
0 commit comments