Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@
pip install -e ".[dev]"
- name: Run all tests
run: pytest

integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run integration test with docker compose
run: |
docker compose up --build --abort-on-container-exit --exit-code-from github-etl
- name: Cleanup
run: docker compose down -v
Comment on lines +24 to +31

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use the latest stable Python image
FROM python:3.11-slim
FROM python:3.14.2-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
Expand Down Expand Up @@ -34,4 +34,4 @@ RUN chown -R app:app /app
USER app

# Set the default command
CMD ["python", "main.py"]
CMD ["python", "main.py"]
2 changes: 1 addition & 1 deletion Dockerfile.mock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dockerfile for mock GitHub API service
FROM python:3.11-slim
FROM python:3.14.2-slim

WORKDIR /app

Expand Down
93 changes: 92 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ docker run --rm \

### Container Specifications

- **Base Image**: `python:3.11-slim` (latest stable Python)
- **Base Image**: `python:3.14.2-slim` (latest stable Python)
- **User**: `app` (uid: 1000, gid: 1000)
- **Working Directory**: `/app`
- **Ownership**: All files in `/app` are owned by the `app` user
Expand Down Expand Up @@ -157,6 +157,97 @@ This setup includes:
- **BigQuery Emulator**: Local BigQuery instance for testing
- **ETL Service**: Configured to use both mock services

### Running Tests

The project includes a comprehensive test suite using pytest. Tests are organized in the `test/` directory and include both unit and integration tests.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The project includes a comprehensive test suite using pytest. Tests are organized in the `test/` directory and include both unit and integration tests.
The project includes a comprehensive test suite using pytest. Tests are organized in the `tests/` directory and include both unit and integration tests.


#### Setting Up the Development Environment
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dockerfile should do all of this for us. We should update these docs to demonstrate how to set up the environment and run the tests using Docker.


1. **Install Python 3.14** (or your compatible Python version)

2. **Install development dependencies**:

```bash
# Install the package with dev dependencies
pip install -e ".[dev]"
```

This installs:
- `pytest` - Testing framework
- `pytest-mock` - Mocking utilities for tests
- `ruff` - Linter
- `black` - Code formatter

3. **Verify installation**:

```bash
pytest --version
```

#### Running the Tests

Run all tests:

```bash
pytest
```

Run tests with verbose output:

```bash
pytest -v
```

Run specific test files:

```bash
pytest tests/test_extract_pull_requests.py
pytest tests/test_transform_data.py
```

Comment on lines 160 to 207
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section refers to a test/ directory and paths like pytest test/test_extract_pull_requests.py, but the repository’s tests live under tests/ (and pytest is configured with testpaths = ["tests"]). Update the docs and example commands/paths to tests/... so they work as written.

Copilot uses AI. Check for mistakes.
Run tests by marker:

```bash
# Run only unit tests
pytest -m unit

# Run only integration tests
pytest -m integration

# Skip slow tests
pytest -m "not slow"
```

Run tests with coverage reporting:

```bash
pytest --cov=. --cov-report=html
```

#### Test Organization
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need a walkthrough of the test files, let's remove this section. The entire file needs to be trimmed down to just the essentials, it is too verbose for what it is communicating.


The test suite is organized into the following files:

- `tests/conftest.py` - Shared pytest fixtures and test configuration
- `tests/test_extract_pull_requests.py` - Tests for PR extraction logic
- `tests/test_extract_commits.py` - Tests for commit extraction
- `tests/test_extract_comments.py` - Tests for comment extraction
- `tests/test_extract_reviewers.py` - Tests for reviewer extraction
- `tests/test_transform_data.py` - Tests for data transformation
- `tests/test_load_data.py` - Tests for BigQuery loading
- `tests/test_rate_limit.py` - Tests for rate limit handling
- `tests/test_main_integration.py` - End-to-end integration tests
- `tests/test_logging.py` - Tests for logging setup
- `tests/test_formatting.py` - Code formatting tests

#### Test Markers

Tests are marked with the following pytest markers:

- `@pytest.mark.unit` - Unit tests for individual functions
- `@pytest.mark.integration` - Integration tests across multiple components
- `@pytest.mark.slow` - Tests that take longer to run
Comment on lines +247 to +249
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These either don't exist, or we don't use them.


### Adding Dependencies

Add new Python packages to `requirements.txt` and rebuild the Docker image.
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies = [
[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"pytest-mock>=3.10.0",
"ruff>=0.14.14",
"black>=24.0.0",
]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.14
# This file is autogenerated by pip-compile with Python 3.10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dockerfile indicates we're using Python 3.14, but these requirements were generated with Python 3.10. We'll probably need to re-generate requirements.

# by the following command:
#
# pip-compile --generate-hashes pyproject.toml
Expand Down
Loading