Skip to content

Commit 5e8b5eb

Browse files
testing: Use nox for running tests on multiple versions
- Modern Python-configured replacement for tox - Use nox in the GitHub Workflow as well - Update msgpack (only); the new version has built wheels for Python 3.14.
1 parent ee476f1 commit 5e8b5eb

4 files changed

Lines changed: 142 additions & 60 deletions

File tree

.github/workflows/test-and-publish.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,8 @@ jobs:
2424
contents: read
2525
packages: write
2626
pull-requests: write
27-
env:
28-
UV_PROJECT_ENVIRONMENT: .venv-${{ matrix.python-version }}
2927
steps:
3028
- uses: actions/checkout@v4
31-
- name: Set up Python
32-
uses: actions/setup-python@v5
33-
with:
34-
python-version: ${{ matrix.python-version }}
3529
- name: Install uv
3630
uses: astral-sh/setup-uv@v6
3731
with:
@@ -40,16 +34,8 @@ jobs:
4034
enable-cache: true
4135
cache-suffix: pre-commit
4236
cache-dependency-glob: uv.lock
43-
- name: Restore venv cache
44-
uses: actions/cache@v4
45-
with:
46-
path: |
47-
${{ env.UV_PROJECT_ENVIRONMENT }}
48-
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
49-
- name: Synchronize project dependencies
50-
run: uv sync --group dev
51-
- name: Run tests
52-
run: uv run pytest
37+
- name: Run tests with nox
38+
run: uvx nox --python ${{ matrix.python-version }} --session tests
5339

5440
publish:
5541
name: Publish to CodeArtifact

noxfile.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import nox
2+
3+
nox.options.default_venv_backend = "uv"
4+
5+
python_versions = ["3.10", "3.11", "3.12", "3.13", "3.14"]
6+
7+
8+
@nox.session(name="tests", python=python_versions, reuse_venv=True)
9+
def tests(session: nox.Session) -> None:
10+
session.run_install(
11+
"uv",
12+
"sync",
13+
"--no-default-groups",
14+
"--group=dev",
15+
"--reinstall-package=pdfrest",
16+
f"--python={session.virtualenv.location}",
17+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
18+
)
19+
session.run("pytest", "--cov=pdfrest", "--cov-report=term-missing")

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ dev = [
3131
"pytest-asyncio>=1.2.0",
3232
"pytest-rerunfailures>=16.0.1",
3333
"pytest-xdist>=3.8.0",
34+
"nox>=2025.5.1",
3435
]
3536

3637
[tool.mypy]

0 commit comments

Comments
 (0)