Skip to content

Commit 124de73

Browse files
shenxianpengclaude
andauthored
ci: run the unit tests, which nothing was running (#257)
main_test.py has 99 tests and CI never executed a single one. The repo's workflows are commit-check (self test), pre-commit (black, mypy, codespell, yaml/toml), release and used-by — none of them invoke pytest. Every release so far shipped with the suite unrun outside contributors' machines. Matrix is the floor and the newest across the three OSes the action supports. 3.10 is the real floor: main.py annotates with `str | None` without `from __future__ import annotations`, so the annotation is evaluated at def time, and main_test.py uses parenthesized context managers — both 3.10+. Installs requirements.txt rather than the bare deps, so the commit-check version under test is the one the action ships, which is also the version the golden tests read back out of importlib.metadata. Verified from a clean venv: the exact install and pytest invocation this workflow runs gives 99 passed, 2 subtests passed. Claude-Session: https://claude.ai/code/session_01U9zFxq8V4qxG4aMzJhGBFn Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent 3773edb commit 124de73

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
branches: [main]
11+
12+
jobs:
13+
test:
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
# The floor and the newest. 3.10 is the real floor: main.py annotates
18+
# with `str | None` and has no `from __future__ import annotations`, so
19+
# the annotation is evaluated at def time, and main_test.py uses
20+
# parenthesized context managers. Both are 3.10+.
21+
#
22+
# The action itself runs on whatever python3 the runner ships, so the
23+
# in-between versions add little here — unlike commit-check, which is a
24+
# published package and tests every one.
25+
py: ['3.10', '3.14']
26+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
27+
runs-on: ${{ matrix.os }}
28+
steps:
29+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
30+
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
31+
with:
32+
python-version: ${{ matrix.py }}
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
# requirements.txt rather than a bare install: it pins the same
38+
# commit-check the action ships, which is the version the golden
39+
# tests expect to read back out of importlib.metadata.
40+
python -m pip install -r requirements.txt pytest
41+
42+
- name: Run unit tests
43+
run: python -m pytest main_test.py -v

0 commit comments

Comments
 (0)