@@ -26,14 +26,14 @@ dev = [
2626 {% endif %} "pipdeptree",
2727 "pre-commit",
2828 {% if sphinx %} "pydata-sphinx-theme>=0.12",
29- {% endif %}{% if type_checker =="pyright" %} "pyright",
30- {% endif %} "pytest",
29+ {% endif %} {% if type_checker =="pyright" %} "pyright",
30+ {% endif %} "pytest>8.3.4 ",
3131 "pytest-cov",
3232 "ruff",
3333 {% if sphinx %} "sphinx-autobuild",
3434 "sphinx-copybutton",
3535 "sphinx-design",
36- {% endif %} "tox-direct ",
36+ {% endif %} "tox-uv ",
3737 "types-mock",
3838]
3939
@@ -77,30 +77,60 @@ data_file = "/tmp/{{ package_name }}.coverage"
7777# Tests are run from installed location, map back to the src directory
7878source = ["src", "**/site-packages/"]
7979
80- # tox must currently be configured via an embedded ini string
81- # See: https://github.com/tox-dev/tox/issues/999
8280[tool.tox]
83- legacy_tox_ini = """
84- [tox]
85- skipsdist=True
81+ skipsdist = true
8682
87- [testenv:{pre-commit,type-checking,tests{% if sphinx %} ,docs{% endif %} }]
88- # Don't create a virtualenv for the command, requires tox-direct plugin
89- direct = True
90- passenv = *
91- allowlist_externals =
92- pytest
93- pre-commit
94- {{ type_checker }}
95- {% if sphinx %} sphinx-build
96- sphinx-autobuild
97- {% endif %} commands =
98- pre-commit: pre-commit run --all-files --show-diff-on-failure {posargs}
99- type-checking: {{ type_checker }} src tests {posargs}
100- tests: pytest --cov={{ package_name }} --cov-report term --cov-report xml:cov.xml {posargs}
101- {% if sphinx %} docs: sphinx-{posargs:build -EW --keep-going} -T docs build/html
102- {% endif %} """
83+ [tool.tox.env.pre-commit]
84+ description = "Run pre-commit"
85+ direct = true
86+ allowlist_externals = ["pre-commit"]
87+ commands = [
88+ [
89+ "pre-commit",
90+ "run",
91+ #"--all-files",
92+ "--show-diff-on-failure",
93+ "{posargs}",
94+ ],
95+ ]
96+
97+ [tool.tox.env.type-checking]
98+ description = "Run type-checking"
99+ direct = true
100+ allowlist_externals = ["{{ type_checker }}"]
101+ commands = [["{{ type_checker }}", "src", "{posargs}"]]
102+
103+ [tool.tox.env.tests]
104+ description = "Run tests"
105+ direct = true
106+ allowlist_externals = ["pytest"]
107+ commands = [
108+ [
109+ "pytest",
110+ "--cov={{ package_name}}",
111+ "--cov-report",
112+ "term",
113+ "--cov-report",
114+ "xml:cov.xml",
115+ "{posargs}",
116+ ],
117+ ]
103118
119+ {% if sphinx %} [tool.tox.env.docs]
120+ description = "Run docs"
121+ direct = true
122+ allowlist_externals = ["sphinx-build", "sphinx-autobuild"]
123+ commands = [
124+ [
125+ "sphinx-{posargs:build}",
126+ "-EW",
127+ "--keep-going",
128+ "-T",
129+ "docs",
130+ "build/html",
131+ ],
132+ ]
133+ {% endif %}
104134[tool.ruff]
105135src = ["src", "tests"]
106136line-length = 88
0 commit comments