Skip to content

Commit 092d9ac

Browse files
committed
📦 Pass desired release to PEP 517 tox env
This patch fixes passing the release version string from the release automation script to the tox's PEP 517 frontend, so that the backend machinery bits (namely, `setuptools-scm`) could access the environment variable; as indentified in the attempt to release pytest v9.0.1 [[1]]. The solution uses the `[pkgenv]` section of `tox.ini` that corresponds to the PEP 517 build env tox manages internally. [1]: https://github.com/pytest-dev/pytest/pull/13928/files#r2514197778 (cherry picked from commit bc0db40)
1 parent 0fa11ae commit 092d9ac

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

tox.ini

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,26 @@ envlist =
2323

2424

2525

26+
[pkgenv]
27+
# NOTE: This section tweaks how Tox manages the PEP 517 build
28+
# NOTE: environment where it assembles wheels (editable and regular)
29+
# NOTE: for further installing them into regular testenvs.
30+
#
31+
# NOTE: `[testenv:.pkg]` does not work due to a regression in tox v4.14.1
32+
# NOTE: so `[pkgenv]` is being used in place of it.
33+
# Refs:
34+
# * https://github.com/tox-dev/tox/pull/3237
35+
# * https://github.com/tox-dev/tox/issues/3238
36+
# * https://github.com/tox-dev/tox/issues/3292
37+
# * https://hynek.me/articles/turbo-charge-tox/
38+
#
39+
# NOTE: The `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST` environment
40+
# NOTE: variable allows enforcing a pre-determined version for use in
41+
# NOTE: the wheel being installed into usual testenvs.
42+
pass_env =
43+
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST
44+
45+
2646
[testenv]
2747
description =
2848
run the tests
@@ -49,7 +69,6 @@ passenv =
4969
COVERAGE_*
5070
PYTEST_ADDOPTS
5171
TERM
52-
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST
5372
CI
5473
setenv =
5574
_PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:} {env:_PYTEST_FILES:}
@@ -141,8 +160,6 @@ setenv =
141160
description =
142161
regenerate documentation examples under `{basepython}`
143162
changedir = doc/en
144-
passenv =
145-
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST
146163
deps =
147164
PyYAML
148165
regendoc>=0.8.1

0 commit comments

Comments
 (0)