Skip to content

Commit b8c06fc

Browse files
committed
Use nox
1 parent 0c71e75 commit b8c06fc

File tree

5 files changed

+120
-6
lines changed

5 files changed

+120
-6
lines changed

.github/workflows/tests.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22

33
name: tests
4+
permissions:
5+
contents: read
46

57
on:
68
push:
@@ -12,12 +14,18 @@ on:
1214

1315
jobs:
1416
test:
15-
name: 'Python ${{ matrix.python-version }}'
17+
name: 'Python ${{ matrix.python-version }} Django ${{ matrix.django-version }}'
1618
runs-on: ubuntu-latest
1719
strategy:
1820
fail-fast: false
1921
matrix:
20-
python-version: ['3.13', '3.12', '3.11']
22+
python-version: ['3.14', '3.13', '3.12', '3.11']
23+
django-version: ['5.2', '5.1', '4.2']
24+
exclude:
25+
- python-version: '3.14'
26+
django-version: '5.1'
27+
- python-version: '3.14'
28+
django-version: '4.2'
2129
steps:
2230
- name: Checkout
2331
run: |
@@ -51,12 +59,12 @@ jobs:
5159
run: |
5260
./manage.py pip_audit
5361
54-
- name: 'Python ${{ matrix.python-version }}'
62+
- name: 'Python ${{ matrix.python-version }} Django ${{ matrix.django-version }}'
5563
env:
5664
PYTHONUNBUFFERED: 1
5765
PYTHONWARNINGS: always
5866
run: |
59-
./manage.py test
67+
./manage.py nox -e "tests-${{ matrix.python-version }}(django='${{ matrix.django-version }}')"
6068
6169
- name: 'Upload coverage report'
6270
uses: codecov/codecov-action@v5

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ To make a new release, do this:
170170
[comment]: <> (✂✂✂ auto generated history start ✂✂✂)
171171

172172
* [**dev**](https://github.com/jedie/PyInventory/compare/v0.23.0...main)
173+
* 2025-11-28 - Use nox
174+
* 2025-11-28 - Update README.md
173175
* 2025-11-28 - Add logo
174176
* [v0.23.0](https://github.com/jedie/PyInventory/compare/v0.22.1...v0.23.0)
175177
* 2025-11-25 - Enhance 'Change category for selected items' and add tests for it

noxfile.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# https://github.com/wntrblm/nox/
3+
# Documentation: https://nox.thea.codes/
4+
#
5+
import nox
6+
from nox.sessions import Session
7+
8+
9+
PYTHON_VERSIONS = ('3.14', '3.13', '3.12', '3.11')
10+
DJANGO_VERSIONS = ('5.2', '5.1', '4.2')
11+
12+
# Python 3.14 needs Django 5.2+
13+
EXCLUDED_COMBINATIONS = [
14+
('3.14', '5.1'),
15+
('3.14', '4.2'),
16+
]
17+
18+
19+
@nox.session(
20+
python=PYTHON_VERSIONS,
21+
venv_backend='uv',
22+
download_python='auto',
23+
)
24+
@nox.parametrize('django', DJANGO_VERSIONS)
25+
def tests(session: Session, django: str):
26+
if (session.python, django) in EXCLUDED_COMBINATIONS:
27+
session.skip('Python 3.14 needs Django 5.2+')
28+
29+
session.install('uv')
30+
session.run(
31+
'uv',
32+
'sync',
33+
'--all-extras',
34+
'--python',
35+
session.python,
36+
env={'UV_PROJECT_ENVIRONMENT': session.virtualenv.location},
37+
)
38+
session.run(
39+
'uv',
40+
'pip',
41+
'install',
42+
f'django>={django},<={django}.999',
43+
env={'UV_PROJECT_ENVIRONMENT': session.virtualenv.location},
44+
)
45+
session.run('python', '-m', 'coverage', 'run', '--context', f'py{session.python}-django{django}')

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ dev = [
4646
"hatchling", # https://github.com/pypa/hatch/tree/master/backend
4747
"playwright", # https://github.com/microsoft/playwright-python
4848
"tblib", # https://github.com/ionelmc/python-tblib
49-
# TODO: "nox", # https://github.com/wntrblm/nox
49+
"nox", # https://github.com/wntrblm/nox
5050
"coverage", # https://github.com/nedbat/coveragepy
5151
"ruff", # https://github.com/astral-sh/ruff
5252
"codespell", # https://github.com/codespell-project/codespell
@@ -97,7 +97,6 @@ version_module_name = "inventory" # Used by "update-readme-history" pre-commit h
9797

9898

9999
[tool.cli_base.pip_audit]
100-
requirements=["requirements.dev.txt"]
101100
strict=true
102101
require_hashes=true
103102
ignore-vuln=[]
@@ -169,6 +168,7 @@ applied_migrations = [
169168
"b3e0624", # 2025-05-01T00:07:45+02:00
170169
"46497a1", # 2025-09-05T08:45:19+02:00
171170
"38082ef", # 2025-10-16T10:28:32+02:00
171+
"95a3003", # 2025-11-28T22:00:56+01:00
172172
]
173173

174174
[manageprojects.cookiecutter_context.cookiecutter]

uv.lock

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)