Skip to content

Commit 9de8e26

Browse files
author
Release Manager
committed
gh-35208: Support tox 4.x for testing modularized distributions <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> ### 📚 Description <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If it resolves an open issue, please link to the issue here. For example "Closes #1337" --> Previous fixes for tox 4.x were not complete, as observed in #35095 (comment) The files `pkgs/*/tox.ini` now requires tox >= 4.2. tox 3.x and 4.x auto-provision a suitable version, so it is not immediately necessary to upgrade our `tox` package (or tighten the version requirements in `build/pkgs/tox/spkg-configure.m4`. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [x] I have made sure that the title is self-explanatory and the description concisely explains the PR. - [x] I have linked an issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open pull requests that this PR logically depends on --> <!-- - #xyz: short description why this is a dependency - #abc: ... --> URL: #35208 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
2 parents 62dd325 + 0c8bb55 commit 9de8e26

File tree

7 files changed

+298
-91
lines changed

7 files changed

+298
-91
lines changed

pkgs/sagemath-categories/tox.ini

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# To build and test in the tox environment:
22
#
3-
# ./sage -sh -c '(cd pkgs/sagemath-categories && tox -v -v -v -e sagepython)'
3+
# make SAGE_WHEELS=yes sagemath_categories-build-deps sagemath_repl && ./sage -sh -c '(cd pkgs/sagemath-categories && SAGE_NUM_THREADS=8 tox -v -v -v -e sagepython-sagewheels-nopypi-norequirements)'
44
#
5-
# To test interactively:
5+
# After this, to test interactively:
66
#
7-
# pkgs/sagemath-categories/.tox/sagepython/bin/python
7+
# pkgs/sagemath-categories/.tox/sagepython-sagewheels-nopypi-norequirements/bin/sage
88
#
99
[tox]
1010
envlist =
11-
sagepython-norequirements
11+
sagepython-sagewheels-nopypi-norequirements
1212

13-
[testenv]
14-
deps =
15-
!norequirements: -rrequirements.txt
16-
# tox 3.x does not handle extras when using --installpkg. https://github.com/tox-dev/tox/issues/1576
17-
sagemath-repl
18-
19-
extras = test
13+
requires =
14+
# Auto-provision a modern tox.
15+
# [pkgenv] added in 4.2 - https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance
16+
tox>=4.2
2017

18+
[pkgenv]
19+
# Environment in which to build the sdist.
20+
# https://tox.wiki/en/latest/upgrading.html#packaging-environments
2121
passenv =
2222
# Variables set by .homebrew-build-env
2323
CPATH
@@ -32,36 +32,73 @@ passenv =
3232
sagewheels: SAGE_SPKG_WHEELS
3333

3434
setenv =
35-
# Sage scripts such as sage-runtests like to use $HOME/.sage
36-
HOME={envdir}
3735
# We supply pip options by environment variables so that they
3836
# apply both to the installation of the dependencies and of the package
3937
sagewheels: PIP_FIND_LINKS=file://{env:SAGE_SPKG_WHEELS:{env:SAGE_VENV:{toxinidir}/../../../../venv}/var/lib/sage/wheels}
4038
nopypi: PIP_NO_INDEX=true
4139

40+
[testenv]
41+
deps =
42+
!norequirements: -rrequirements.txt
43+
44+
extras = test
45+
46+
passenv = {[pkgenv]passenv}
47+
48+
setenv = {[pkgenv]setenv}
49+
# Sage scripts such as sage-runtests like to use $HOME/.sage
50+
HOME={envdir}
51+
4252
allowlist_externals =
4353
bash
4454

4555
commands =
46-
# Beware of the treacherous non-src layout. "./sage/" shadows the install sage package.
56+
# Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package.
4757
{envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.cpython.builtin_types, sage.cpython.cython_metaclass, sage.cpython.debug, sage.structure.all, sage.categories.all'
4858

4959
# Test that importing sage.categories.all initializes categories
5060
{envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.categories.all import *; SimplicialComplexes(); FunctionFields()'
5161

52-
bash -c 'cd {temp_dir} && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --initial --environment=sage.all__sagemath_categories --optional=sage $SAGE_SRC/sage/structure || echo "(lots of doctest failures are expected)"'
62+
bash -c 'cd $(python -c "import sys; \"\" in sys.path and sys.path.remove(\"\"); from sage.env import SAGE_LIB; print(SAGE_LIB)") \
63+
&& sage-runtests -p --initial --environment=sage.all__sagemath_categories --optional=sage sage/structure || echo "(lots of doctest failures are expected)"'
64+
65+
[testenv:.tox]
66+
# Allow access to PyPI for auto-provisioning a suitable tox version
67+
passenv =
68+
setenv = PIP_NO_INDEX=false
69+
70+
[testenv:.pkg-sagepython]
71+
# Environment in which to build the sdist.
72+
# inherits from [pkgenv] - https://tox.wiki/en/latest/upgrading.html#packaging-environments
73+
basepython = {env:SAGE_VENV}/bin/python3
74+
75+
[testenv:.pkg-sagepython-sagewheels-nopypi]
76+
passenv = {[pkgenv]passenv}
77+
SAGE_VENV
78+
SAGE_SPKG_WHEELS
79+
80+
setenv = {[pkgenv]setenv}
81+
PIP_FIND_LINKS=file://{env:SAGE_SPKG_WHEELS:{env:SAGE_VENV:{toxinidir}/../../../../venv}/var/lib/sage/wheels}
82+
PIP_NO_INDEX=true
83+
84+
basepython = {env:SAGE_VENV}/bin/python3
5385

5486
[testenv:sagepython]
5587
basepython = {env:SAGE_VENV}/bin/python3
88+
package_env = .pkg-sagepython
5689

5790
[testenv:sagepython-sagewheels-nopypi]
5891
basepython = {env:SAGE_VENV}/bin/python3
92+
package_env = .pkg-sagepython-sagewheels-nopypi
5993

6094
[testenv:sagepython-sagewheels-nopypi-norequirements]
6195
basepython = {env:SAGE_VENV}/bin/python3
96+
package_env = .pkg-sagepython-sagewheels-nopypi
6297

6398
[testenv:sagepython-sagewheels]
64-
basepython = {env:SAGE_VENV}/bin/python3
99+
basepython = {env:SAGE_VENV}/bin/python
100+
package_env = .pkg-sagepython
65101

66102
[testenv:sagepython-norequirements]
67103
basepython = {env:SAGE_VENV}/bin/python3
104+
package_env = .pkg-sagepython

pkgs/sagemath-environment/tox.ini

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
# To build and test in the tox environment:
22
#
3-
# ./sage -sh -c '(cd pkgs/sagemath-environment && tox -v -v -e sagepython)'
3+
# ./sage -sh -c '(cd pkgs/sagemath-environment && tox -v -v -e sagepython-norequirements)'
44
#
55
# To test interactively:
66
#
7-
# pkgs/sagemath-environment/.tox/sagepython/bin/python
7+
# pkgs/sagemath-environment/.tox/sagepython-norequirements/bin/python
88
#
99
[tox]
1010
envlist =
1111
sagepython-norequirements
1212

13-
isolated_build = True
14-
15-
[testenv]
16-
deps =
17-
!norequirements: -rrequirements.txt
13+
requires =
14+
# Auto-provision a modern tox.
15+
# [pkgenv] added in 4.2 - https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance
16+
tox>=4.2
1817

18+
[pkgenv]
19+
# Environment in which to build the sdist.
20+
# https://tox.wiki/en/latest/upgrading.html#packaging-environments
1921
passenv =
22+
# Variables set by .homebrew-build-env
23+
CPATH
24+
LIBRARY_PATH
25+
PKG_CONFIG_PATH
2026
# Parallel build
2127
SAGE_NUM_THREADS
2228
SAGE_NUM_THREADS_PARALLEL
@@ -26,31 +32,67 @@ passenv =
2632
sagewheels: SAGE_SPKG_WHEELS
2733

2834
setenv =
29-
# Sage scripts such as sage-runtests like to use $HOME/.sage
30-
HOME={envdir}
3135
# We supply pip options by environment variables so that they
3236
# apply both to the installation of the dependencies and of the package
3337
sagewheels: PIP_FIND_LINKS=file://{env:SAGE_SPKG_WHEELS:{env:SAGE_VENV:{toxinidir}/../../../../venv}/var/lib/sage/wheels}
3438
nopypi: PIP_NO_INDEX=true
3539

40+
[testenv]
41+
deps =
42+
!norequirements: -rrequirements.txt
43+
44+
extras = test
45+
46+
passenv = {[pkgenv]passenv}
47+
48+
setenv = {[pkgenv]setenv}
49+
# Sage scripts such as sage-runtests like to use $HOME/.sage
50+
HOME={envdir}
51+
3652
allowlist_externals =
3753
bash
3854

3955
commands =
4056
# Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package.
4157
{envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.features.all import all_features; print(sorted(all_features(), key=lambda x: x.name)); import sage.misc.package'
4258

59+
[testenv:.tox]
60+
# Allow access to PyPI for auto-provisioning a suitable tox version
61+
passenv =
62+
setenv = PIP_NO_INDEX=false
63+
64+
[testenv:.pkg-sagepython]
65+
# Environment in which to build the sdist.
66+
# inherits from [pkgenv] - https://tox.wiki/en/latest/upgrading.html#packaging-environments
67+
basepython = {env:SAGE_VENV}/bin/python3
68+
69+
[testenv:.pkg-sagepython-sagewheels-nopypi]
70+
passenv = {[pkgenv]passenv}
71+
SAGE_VENV
72+
SAGE_SPKG_WHEELS
73+
74+
setenv = {[pkgenv]setenv}
75+
PIP_FIND_LINKS=file://{env:SAGE_SPKG_WHEELS:{env:SAGE_VENV:{toxinidir}/../../../../venv}/var/lib/sage/wheels}
76+
PIP_NO_INDEX=true
77+
78+
basepython = {env:SAGE_VENV}/bin/python3
79+
4380
[testenv:sagepython]
4481
basepython = {env:SAGE_VENV}/bin/python3
82+
package_env = .pkg-sagepython
4583

4684
[testenv:sagepython-sagewheels-nopypi]
4785
basepython = {env:SAGE_VENV}/bin/python3
86+
package_env = .pkg-sagepython-sagewheels-nopypi
4887

4988
[testenv:sagepython-sagewheels-nopypi-norequirements]
5089
basepython = {env:SAGE_VENV}/bin/python3
90+
package_env = .pkg-sagepython-sagewheels-nopypi
5191

5292
[testenv:sagepython-sagewheels]
53-
basepython = {env:SAGE_VENV}/bin/python3
93+
basepython = {env:SAGE_VENV}/bin/python
94+
package_env = .pkg-sagepython
5495

5596
[testenv:sagepython-norequirements]
5697
basepython = {env:SAGE_VENV}/bin/python3
98+
package_env = .pkg-sagepython

pkgs/sagemath-objects/tox.ini

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
# To build and test in the tox environment:
22
#
3-
# ./sage -sh -c '(cd pkgs/sagemath-objects && tox -v -v -e sagepython)'
3+
# ./sage -sh -c '(cd pkgs/sagemath-objects && SAGE_NUM_THREADS=8 tox -v -v -e sagepython-norequirements)'
44
#
5-
# To test interactively:
5+
# After this, to test interactively:
66
#
7-
# pkgs/sagemath-objects/.tox/sagepython/bin/python
7+
# pkgs/sagemath-objects/.tox/sagepython-norequirements/bin/python
88
#
99
[tox]
1010
envlist =
1111
sagepython-norequirements
1212

13-
[testenv]
14-
deps =
15-
!norequirements: -rrequirements.txt
16-
17-
extras = test
13+
requires =
14+
# Auto-provision a modern tox.
15+
# [pkgenv] added in 4.2 - https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance
16+
tox>=4.2
1817

18+
[pkgenv]
19+
# Environment in which to build the sdist.
20+
# https://tox.wiki/en/latest/upgrading.html#packaging-environments
1921
passenv =
2022
# Variables set by .homebrew-build-env
2123
CPATH
@@ -30,13 +32,23 @@ passenv =
3032
sagewheels: SAGE_SPKG_WHEELS
3133

3234
setenv =
33-
# Sage scripts such as sage-runtests like to use $HOME/.sage
34-
HOME={envdir}
3535
# We supply pip options by environment variables so that they
3636
# apply both to the installation of the dependencies and of the package
3737
sagewheels: PIP_FIND_LINKS=file://{env:SAGE_SPKG_WHEELS:{env:SAGE_VENV:{toxinidir}/../../../../venv}/var/lib/sage/wheels}
3838
nopypi: PIP_NO_INDEX=true
3939

40+
[testenv]
41+
deps =
42+
!norequirements: -rrequirements.txt
43+
44+
extras = test
45+
46+
passenv = {[pkgenv]passenv}
47+
48+
setenv = {[pkgenv]setenv}
49+
# Sage scripts such as sage-runtests like to use $HOME/.sage
50+
HOME={envdir}
51+
4052
allowlist_externals =
4153
bash
4254

@@ -48,17 +60,43 @@ commands =
4860

4961
#bash -c 'cd {temp_dir} && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_objects --initial --optional=sage $SAGE_SRC/sage/structure || echo "(lots of doctest failures are expected)"'
5062

63+
[testenv:.tox]
64+
# Allow access to PyPI for auto-provisioning a suitable tox version
65+
passenv =
66+
setenv = PIP_NO_INDEX=false
67+
68+
[testenv:.pkg-sagepython]
69+
# Environment in which to build the sdist.
70+
# inherits from [pkgenv] - https://tox.wiki/en/latest/upgrading.html#packaging-environments
71+
basepython = {env:SAGE_VENV}/bin/python3
72+
73+
[testenv:.pkg-sagepython-sagewheels-nopypi]
74+
passenv = {[pkgenv]passenv}
75+
SAGE_VENV
76+
SAGE_SPKG_WHEELS
77+
78+
setenv = {[pkgenv]setenv}
79+
PIP_FIND_LINKS=file://{env:SAGE_SPKG_WHEELS:{env:SAGE_VENV:{toxinidir}/../../../../venv}/var/lib/sage/wheels}
80+
PIP_NO_INDEX=true
81+
82+
basepython = {env:SAGE_VENV}/bin/python3
83+
5184
[testenv:sagepython]
5285
basepython = {env:SAGE_VENV}/bin/python3
86+
package_env = .pkg-sagepython
5387

5488
[testenv:sagepython-sagewheels-nopypi]
5589
basepython = {env:SAGE_VENV}/bin/python3
90+
package_env = .pkg-sagepython-sagewheels-nopypi
5691

5792
[testenv:sagepython-sagewheels-nopypi-norequirements]
5893
basepython = {env:SAGE_VENV}/bin/python3
94+
package_env = .pkg-sagepython-sagewheels-nopypi
5995

6096
[testenv:sagepython-sagewheels]
61-
basepython = {env:SAGE_VENV}/bin/python3
97+
basepython = {env:SAGE_VENV}/bin/python
98+
package_env = .pkg-sagepython
6299

63100
[testenv:sagepython-norequirements]
64101
basepython = {env:SAGE_VENV}/bin/python3
102+
package_env = .pkg-sagepython

0 commit comments

Comments
 (0)