11[tox]
2- minversion = 4.16.0
2+ minversion = 4.23.2
33envlist =
44 py3{9, 10, 11, 12}
55 linters
@@ -9,6 +9,12 @@ python = python3
99skip_install = true
1010package = frouros
1111venv = {toxinidir}/.venv
12+ deps =
13+ # Package used as a workaround to install the dependencies read from pyproject.toml dev section.
14+ toml>=0.10.2,<0.11
15+ pyproject_reader =
16+ # Workaround to install the dependencies read from pyproject.toml dev section. Use toml to read the file and install the dependencies.
17+ python -c " import toml, subprocess; deps = toml.load('pyproject.toml')['project']['optional-dependencies']['{env:DEPS_SECTION}']; subprocess.run(['pip', 'install'] + deps)"
1218
1319[gh-actions]
1420python =
@@ -20,8 +26,13 @@ python =
2026[testenv]
2127# Force to upgrade pip/wheel/setuptools to the latest version
2228download = True
23- extras = dev-tests
24- commands = pytest --cov ={[base]package} \
29+ deps = {[base]deps}
30+ setenv =
31+ DEPS_SECTION = dev-tests
32+ commands_pre =
33+ {[base]pyproject_reader}
34+ commands =
35+ pytest --cov ={[base]package} \
2536 --cov-report term \
2637 --cov-report =xml \
2738 --cov-fail-under =90
@@ -31,16 +42,36 @@ addopts = -ra -q
3142norecursedirs = docs
3243
3344[testenv:ruff]
34- extras = dev-ruff
45+ basepython = {[base]python}
46+ skip_install = {[base]skip_install}
47+ deps = {[base]deps}
48+ setenv =
49+ DEPS_SECTION = dev-ruff
50+ commands_pre =
51+ {[base]pyproject_reader}
3552commands = ruff check --config pyproject.toml .
3653 ruff format --config pyproject.toml .
3754
3855[testenv:mypy]
39- extras = dev-mypy
56+ basepython = {[base]python}
57+ skip_install = {[base]skip_install}
58+ deps = {[base]deps}
59+ setenv =
60+ DEPS_SECTION = dev-mypy
61+ commands_pre =
62+ {[base]pyproject_reader}
4063commands = mypy --config-file pyproject.toml .
4164
4265[testenv:linters]
43- extras = dev-linters
66+ basepython = {[base]python}
67+ skip_install = {[base]skip_install}
68+ setenv =
69+ PYTHONPATH = $PYTHONPATH:{toxinidir}:{[base]venv}/lib/{[base]python}/site-packages
70+ deps =
71+ {[base]deps}
72+ commands_pre =
73+ {[testenv:ruff]commands_pre}
74+ {[testenv:mypy]commands_pre}
4475commands =
4576 {[testenv:ruff]commands}
4677 {[testenv:mypy]commands}
0 commit comments