claude-code-sdk-python/Dockerfile.test
Ashwin Bhat d8c0af94ee
Add Docker-based test infrastructure for e2e tests
Add Docker test infrastructure to catch container-specific issues like #406
where filesystem-based agents may silently fail in Docker environments.

Changes:
- Add Dockerfile.test: Python 3.12 image with Claude Code CLI installed
- Add scripts/test-docker.sh: Local script to run tests in Docker
- Add test-e2e-docker job to CI workflow
- Add .dockerignore to speed up Docker builds

Usage:
  ./scripts/test-docker.sh unit    # Run unit tests in Docker
  ./scripts/test-docker.sh e2e     # Run e2e tests (needs ANTHROPIC_API_KEY)
  ./scripts/test-docker.sh all     # Run all tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-16 10:20:12 -08:00

29 lines
676 B
Text

# Dockerfile for running SDK tests in a containerized environment
# This helps catch Docker-specific issues like #406
FROM python:3.12-slim
# Install dependencies for Claude CLI and git (needed for some tests)
RUN apt-get update && apt-get install -y \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Install Claude Code CLI
RUN curl -fsSL https://claude.ai/install.sh | bash
ENV PATH="/root/.local/bin:$PATH"
# Set up working directory
WORKDIR /app
# Copy the SDK source
COPY . .
# Install SDK with dev dependencies
RUN pip install -e ".[dev]"
# Verify CLI installation
RUN claude -v
# Default: run unit tests
CMD ["python", "-m", "pytest", "tests/", "-v"]