Skip to content

Commit

Permalink
gh-35208: Support tox 4.x for testing modularized distributions
Browse files Browse the repository at this point in the history
    
<!-- ^^^^^
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
  • Loading branch information
Release Manager committed May 21, 2023
2 parents 62dd325 + 0c8bb55 commit 9de8e26
Show file tree
Hide file tree
Showing 7 changed files with 298 additions and 91 deletions.
69 changes: 53 additions & 16 deletions pkgs/sagemath-categories/tox.ini
@@ -1,23 +1,23 @@
# To build and test in the tox environment:
#
# ./sage -sh -c '(cd pkgs/sagemath-categories && tox -v -v -v -e sagepython)'
# 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)'
#
# To test interactively:
# After this, to test interactively:
#
# pkgs/sagemath-categories/.tox/sagepython/bin/python
# pkgs/sagemath-categories/.tox/sagepython-sagewheels-nopypi-norequirements/bin/sage
#
[tox]
envlist =
sagepython-norequirements
sagepython-sagewheels-nopypi-norequirements

[testenv]
deps =
!norequirements: -rrequirements.txt
# tox 3.x does not handle extras when using --installpkg. https://github.com/tox-dev/tox/issues/1576
sagemath-repl

extras = test
requires =
# Auto-provision a modern tox.
# [pkgenv] added in 4.2 - https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance
tox>=4.2

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

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

[testenv]
deps =
!norequirements: -rrequirements.txt

extras = test

passenv = {[pkgenv]passenv}

setenv = {[pkgenv]setenv}
# Sage scripts such as sage-runtests like to use $HOME/.sage
HOME={envdir}

allowlist_externals =
bash

commands =
# Beware of the treacherous non-src layout. "./sage/" shadows the install sage package.
# Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package.
{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'

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

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)"'
bash -c 'cd $(python -c "import sys; \"\" in sys.path and sys.path.remove(\"\"); from sage.env import SAGE_LIB; print(SAGE_LIB)") \
&& sage-runtests -p --initial --environment=sage.all__sagemath_categories --optional=sage sage/structure || echo "(lots of doctest failures are expected)"'

[testenv:.tox]
# Allow access to PyPI for auto-provisioning a suitable tox version
passenv =
setenv = PIP_NO_INDEX=false

[testenv:.pkg-sagepython]
# Environment in which to build the sdist.
# inherits from [pkgenv] - https://tox.wiki/en/latest/upgrading.html#packaging-environments
basepython = {env:SAGE_VENV}/bin/python3

[testenv:.pkg-sagepython-sagewheels-nopypi]
passenv = {[pkgenv]passenv}
SAGE_VENV
SAGE_SPKG_WHEELS

setenv = {[pkgenv]setenv}
PIP_FIND_LINKS=file://{env:SAGE_SPKG_WHEELS:{env:SAGE_VENV:{toxinidir}/../../../../venv}/var/lib/sage/wheels}
PIP_NO_INDEX=true

basepython = {env:SAGE_VENV}/bin/python3

[testenv:sagepython]
basepython = {env:SAGE_VENV}/bin/python3
package_env = .pkg-sagepython

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

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

[testenv:sagepython-sagewheels]
basepython = {env:SAGE_VENV}/bin/python3
basepython = {env:SAGE_VENV}/bin/python
package_env = .pkg-sagepython

[testenv:sagepython-norequirements]
basepython = {env:SAGE_VENV}/bin/python3
package_env = .pkg-sagepython
62 changes: 52 additions & 10 deletions pkgs/sagemath-environment/tox.ini
@@ -1,22 +1,28 @@
# To build and test in the tox environment:
#
# ./sage -sh -c '(cd pkgs/sagemath-environment && tox -v -v -e sagepython)'
# ./sage -sh -c '(cd pkgs/sagemath-environment && tox -v -v -e sagepython-norequirements)'
#
# To test interactively:
#
# pkgs/sagemath-environment/.tox/sagepython/bin/python
# pkgs/sagemath-environment/.tox/sagepython-norequirements/bin/python
#
[tox]
envlist =
sagepython-norequirements

isolated_build = True

[testenv]
deps =
!norequirements: -rrequirements.txt
requires =
# Auto-provision a modern tox.
# [pkgenv] added in 4.2 - https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance
tox>=4.2

[pkgenv]
# Environment in which to build the sdist.
# https://tox.wiki/en/latest/upgrading.html#packaging-environments
passenv =
# Variables set by .homebrew-build-env
CPATH
LIBRARY_PATH
PKG_CONFIG_PATH
# Parallel build
SAGE_NUM_THREADS
SAGE_NUM_THREADS_PARALLEL
Expand All @@ -26,31 +32,67 @@ passenv =
sagewheels: SAGE_SPKG_WHEELS

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

[testenv]
deps =
!norequirements: -rrequirements.txt

extras = test

passenv = {[pkgenv]passenv}

setenv = {[pkgenv]setenv}
# Sage scripts such as sage-runtests like to use $HOME/.sage
HOME={envdir}

allowlist_externals =
bash

commands =
# Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package.
{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'

[testenv:.tox]
# Allow access to PyPI for auto-provisioning a suitable tox version
passenv =
setenv = PIP_NO_INDEX=false

[testenv:.pkg-sagepython]
# Environment in which to build the sdist.
# inherits from [pkgenv] - https://tox.wiki/en/latest/upgrading.html#packaging-environments
basepython = {env:SAGE_VENV}/bin/python3

[testenv:.pkg-sagepython-sagewheels-nopypi]
passenv = {[pkgenv]passenv}
SAGE_VENV
SAGE_SPKG_WHEELS

setenv = {[pkgenv]setenv}
PIP_FIND_LINKS=file://{env:SAGE_SPKG_WHEELS:{env:SAGE_VENV:{toxinidir}/../../../../venv}/var/lib/sage/wheels}
PIP_NO_INDEX=true

basepython = {env:SAGE_VENV}/bin/python3

[testenv:sagepython]
basepython = {env:SAGE_VENV}/bin/python3
package_env = .pkg-sagepython

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

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

[testenv:sagepython-sagewheels]
basepython = {env:SAGE_VENV}/bin/python3
basepython = {env:SAGE_VENV}/bin/python
package_env = .pkg-sagepython

[testenv:sagepython-norequirements]
basepython = {env:SAGE_VENV}/bin/python3
package_env = .pkg-sagepython
60 changes: 49 additions & 11 deletions pkgs/sagemath-objects/tox.ini
@@ -1,21 +1,23 @@
# To build and test in the tox environment:
#
# ./sage -sh -c '(cd pkgs/sagemath-objects && tox -v -v -e sagepython)'
# ./sage -sh -c '(cd pkgs/sagemath-objects && SAGE_NUM_THREADS=8 tox -v -v -e sagepython-norequirements)'
#
# To test interactively:
# After this, to test interactively:
#
# pkgs/sagemath-objects/.tox/sagepython/bin/python
# pkgs/sagemath-objects/.tox/sagepython-norequirements/bin/python
#
[tox]
envlist =
sagepython-norequirements

[testenv]
deps =
!norequirements: -rrequirements.txt

extras = test
requires =
# Auto-provision a modern tox.
# [pkgenv] added in 4.2 - https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance
tox>=4.2

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

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

[testenv]
deps =
!norequirements: -rrequirements.txt

extras = test

passenv = {[pkgenv]passenv}

setenv = {[pkgenv]setenv}
# Sage scripts such as sage-runtests like to use $HOME/.sage
HOME={envdir}

allowlist_externals =
bash

Expand All @@ -48,17 +60,43 @@ commands =

#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)"'

[testenv:.tox]
# Allow access to PyPI for auto-provisioning a suitable tox version
passenv =
setenv = PIP_NO_INDEX=false

[testenv:.pkg-sagepython]
# Environment in which to build the sdist.
# inherits from [pkgenv] - https://tox.wiki/en/latest/upgrading.html#packaging-environments
basepython = {env:SAGE_VENV}/bin/python3

[testenv:.pkg-sagepython-sagewheels-nopypi]
passenv = {[pkgenv]passenv}
SAGE_VENV
SAGE_SPKG_WHEELS

setenv = {[pkgenv]setenv}
PIP_FIND_LINKS=file://{env:SAGE_SPKG_WHEELS:{env:SAGE_VENV:{toxinidir}/../../../../venv}/var/lib/sage/wheels}
PIP_NO_INDEX=true

basepython = {env:SAGE_VENV}/bin/python3

[testenv:sagepython]
basepython = {env:SAGE_VENV}/bin/python3
package_env = .pkg-sagepython

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

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

[testenv:sagepython-sagewheels]
basepython = {env:SAGE_VENV}/bin/python3
basepython = {env:SAGE_VENV}/bin/python
package_env = .pkg-sagepython

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

0 comments on commit 9de8e26

Please sign in to comment.