Skip to content

Commit 16232cc

Browse files
authored
test: improve coverage for core logic (#46)
1 parent faf8a50 commit 16232cc

15 files changed

+4147
-2
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ jobs:
5555
test:
5656
name: Unit Tests (Python ${{ matrix.python-version }})
5757
runs-on: ubuntu-latest
58+
timeout-minutes: 30
5859
strategy:
60+
fail-fast: false
5961
matrix:
6062
python-version: ["3.9", "3.14"]
6163
steps:
@@ -70,11 +72,31 @@ jobs:
7072
- name: Setup Python
7173
run: uv python install ${{ matrix.python-version }}
7274

75+
- name: Cache uv + Python installs + venv
76+
uses: actions/cache@v4
77+
with:
78+
path: |
79+
~/.cache/uv
80+
~/.local/share/uv/python
81+
.venv
82+
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
83+
7384
- name: Install dependencies
7485
run: uv sync --all-extras
7586

7687
- name: Run unit tests
77-
run: uv run pytest tests/unit/ -v
88+
if: matrix.python-version != '3.9'
89+
run: uv run pytest tests/unit/ -q
90+
91+
- name: Run unit tests with coverage
92+
if: matrix.python-version == '3.9'
93+
run: uv run pytest tests/unit/ -q --cov=drift/core --cov-report=xml
94+
95+
- name: Upload coverage to Coveralls
96+
if: matrix.python-version == '3.9' && github.event_name == 'push' && github.ref == 'refs/heads/main'
97+
uses: coverallsapp/github-action@v2
98+
with:
99+
file: coverage.xml
78100

79101
build:
80102
name: Build Package

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,9 @@ __marimo__/
224224
.DS_Store
225225

226226
# Bug tracking
227-
**/BUG_TRACKING.md
227+
**/BUG_TRACKING.md
228+
229+
# Coverage
230+
coverage.lcov
231+
coverage.xml
232+
.coverage

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ uv run ty check drift/ tests/ # Type check
3333
```bash
3434
uv run pytest tests/unit/ -v
3535

36+
# Run with coverage
37+
uv run pytest tests/unit/ -v --cov=drift --cov-report=term-missing
38+
3639
# Run a specific test file
3740
uv run pytest tests/unit/test_json_schema_helper.py -v
3841
uv run pytest tests/unit/test_adapters.py -v

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ dev = [
5353
"ty>=0.0.1a7",
5454
"pytest>=8.0.0,<9.0.0",
5555
"pytest-mock>=3.15.0",
56+
"pytest-cov>=7.0.0",
5657
]
5758

5859
[project.urls]

0 commit comments

Comments
 (0)