Skip to content

Commit 67b7836

Browse files
authored
Add tox for easy testing of many Python versions (#523)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent a51e311 commit 67b7836

File tree

5 files changed

+102
-27
lines changed

5 files changed

+102
-27
lines changed

.github/workflows/lint.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
env:
6+
FORCE_COLOR: 1
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.x"
20+
- uses: pre-commit/[email protected]

.github/workflows/tests.yml

+13-13
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ env:
66
FORCE_COLOR: 1
77

88
jobs:
9-
build_ubuntu:
9+
test:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
13+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
1414
name: ${{ matrix.python-version }}
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
- uses: actions/setup-python@v5
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
1921
with:
2022
python-version: ${{ matrix.python-version }}
2123
allow-prereleases: true
2224
cache: pip
23-
cache-dependency-path: ".github/workflows/tests.yml"
24-
- name: setup
25+
26+
- name: Install dependencies
2527
run: |
2628
python --version
2729
python -m pip install --upgrade pip
28-
python -m pip install --upgrade pytest pytest-cov pyfakefs
29-
- name: install
30+
python -m pip install --upgrade tox
31+
32+
- name: Tox tests
3033
run: |
3134
cd blurb
35+
tox -e py
36+
3237
python -m pip install -e .
33-
- name: test
34-
run: |
35-
blurb test
36-
- name: pytest
37-
run: |
38-
python -I -m pytest --cov blurb
38+
3939
- name: Upload coverage
4040
uses: codecov/codecov-action@v3
4141
with:

.pre-commit-config.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: check-case-conflict
6+
- id: check-merge-conflict
7+
- id: check-toml
8+
- id: check-yaml
9+
- id: debug-statements
10+
11+
- repo: https://github.com/tox-dev/tox-ini-fmt
12+
rev: 1.3.1
13+
hooks:
14+
- id: tox-ini-fmt
15+
16+
- repo: meta
17+
hooks:
18+
- id: check-hooks-apply
19+
- id: check-useless-excludes
20+
21+
ci:
22+
autoupdate_schedule: quarterly

blurb/pyproject.toml

+26-14
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
[build-system]
2-
requires = ["flit_core >=2,<4"]
32
build-backend = "flit_core.buildapi"
3+
requires = [
4+
"flit_core<4,>=2",
5+
]
46

5-
[tool.flit.metadata]
6-
module = "blurb"
7-
author = "Larry Hastings"
8-
author-email = "[email protected]"
9-
maintainer = "Python Core Developers"
10-
maintainer-email = "[email protected]"
11-
home-page = "https://github.com/python/core-workflow/tree/main/blurb"
7+
[project]
8+
name = "blurb"
9+
description = "Command-line tool to manage CPython Misc/NEWS.d entries."
10+
readme = "README.rst"
11+
maintainers = [{name = "Python Core Developers", email="[email protected]"}]
12+
authors = [{ name="Larry Hastings", email="[email protected]"}]
1213
requires-python = ">=3.8"
13-
description-file = "README.rst"
1414
classifiers = [
15-
"Intended Audience :: Developers",
16-
"License :: OSI Approved :: BSD License",
17-
"Programming Language :: Python :: 3 :: Only"
15+
"Intended Audience :: Developers",
16+
"License :: OSI Approved :: BSD License",
17+
"Programming Language :: Python :: 3 :: Only",
1818
]
19-
20-
[tool.flit.scripts]
19+
dynamic = [
20+
"version",
21+
]
22+
[project.optional-dependencies]
23+
tests = [
24+
"pyfakefs",
25+
"pytest",
26+
"pytest-cov",
27+
]
28+
[project.urls]
29+
Changelog = "https://github.com/python/core-workflow/tree/main/blurb#changelog"
30+
Homepage = "https://github.com/python/core-workflow/tree/main/blurb"
31+
Source = "https://github.com/python/core-workflow/tree/main/blurb"
32+
[project.scripts]
2133
blurb = "blurb:main"

blurb/tox.ini

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[tox]
2+
requires =
3+
tox>=4.2
4+
env_list =
5+
py{313, 312, 311, 310, 39, 38}
6+
7+
[testenv]
8+
extras =
9+
tests
10+
pass_env =
11+
FORCE_COLOR
12+
commands =
13+
{envpython} -I -m pytest \
14+
--cov blurb \
15+
--cov tests \
16+
--cov-report html \
17+
--cov-report term \
18+
--cov-report xml \
19+
{posargs}
20+
blurb test
21+
blurb help

0 commit comments

Comments
 (0)