Skip to content

Commit f124383

Browse files
authored
Update tox usages for v4 (#204)
Can no longer pass an env list with factors as a curly-brace expression to `tox -e`, so use a label with explicitly enumerated environments instead. Update `Makefile` and GitHub Actions usages to explicitly call `tox run`. Unrelated to tox v4, cleanup the declaration of coverage steps to use only one tox env to run `coverage` commands.
1 parent 9d69448 commit f124383

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/checkout@v2
1111
- uses: actions/setup-python@v2
1212
- run: python -m pip install tox
13-
- run: python -m tox -e mypy
13+
- run: python -m tox run -e mypy
1414

1515
test:
1616
strategy:
@@ -27,9 +27,9 @@ jobs:
2727
- name: install requirements
2828
run: python -m pip install tox
2929
- name: test
30-
run: python -m tox -e "py{,-json5,-pyjson5,-tomli}{,-format}"
30+
run: python -m tox run -m ci
3131
- name: twine-check
32-
run: python -m tox -e twine-check
32+
run: python -m tox run -e twine-check
3333

3434
self-check:
3535
name: "Self-Check"

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ PKG_VERSION=$(shell grep '^version' setup.cfg | cut -d '=' -f2 | tr -d ' ')
33
.PHONY: lint test vendor-schemas generate-hooks release showvars
44
lint:
55
pre-commit run -a
6-
tox -e mypy
6+
tox run -e mypy
77
test:
8-
tox
8+
tox run
99
vendor-schemas:
10-
tox -e vendor-schemas
10+
tox run -e vendor-schemas
1111
generate-hooks:
12-
tox -e generate-hooks-config
12+
tox run -e generate-hooks-config
1313
showvars:
1414
@echo "PKG_VERSION=$(PKG_VERSION)"
1515
release:
1616
git tag -s "$(PKG_VERSION)" -m "v$(PKG_VERSION)"
1717
-git push $(shell git rev-parse --abbrev-ref @{push} | cut -d '/' -f1) refs/tags/$(PKG_VERSION)
18-
tox -e publish-release
18+
tox run -e publish-release
1919

2020
.PHONY: clean
2121
clean:

tox.ini

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
[tox]
2+
# desired label:
3+
# ci = py{,-json5,-pyjson5,-tomli}{,-format}"
4+
#
5+
# a tox issue will be filed to ask how this could be better supported
6+
# for now, 'ci' is an expanded matrix:
7+
labels =
8+
ci = py, py-format, py-json5, py-json5-format, py-pyjson5, py-pyjson5-format, py-tomli, py-tomli-format, coverage
9+
210
envlist =
311
cov-{clean,combine,report}
412
py{311,310,39,38,37}
@@ -17,24 +25,17 @@ deps =
1725
format: jsonschema[format]
1826
commands = coverage run -m pytest {posargs}
1927
depends =
20-
py{37,38,39,310,311}{,-json5,-pyjson5,-tomli}: cov-clean
21-
cov-combine: py{37,38,39,310,311}{,-json5,-pyjson5,-tomli}
22-
cov-report: cov-combine
23-
24-
[testenv:cov-clean]
25-
deps = coverage
26-
skip_install = true
27-
commands = coverage erase
28-
29-
[testenv:cov-combine]
30-
deps = coverage
31-
skip_install = true
32-
commands = coverage combine
28+
py{,37,38,39,310,311}{,-json5,-pyjson5,-tomli}: coverage-clean
29+
coverage: py{,37,38,39,310,311}{,-json5,-pyjson5,-tomli}
3330

34-
[testenv:cov-report]
31+
[testenv:coverage{,-clean}]
3532
deps = coverage
3633
skip_install = true
37-
commands = coverage report --skip-covered
34+
commands_pre =
35+
!clean: coverage combine
36+
commands =
37+
clean: coverage erase
38+
!clean: coverage report --skip-covered
3839

3940
[testenv:mypy]
4041
deps = mypy

0 commit comments

Comments
 (0)