# All tests require an installation of the non-Python components of the Sage distribution1# in SAGE_LOCAL.2#3# See envlist below for different environments.4#5# To build and test in the tox environment using the concrete Python dependencies specified6# by requirements.txt, using the wheels built and stored by the Sage distribution:7# (Using 'sage -sh' in combination with 'sagepython-...' tox environments8# ensures that we use the same Python as the one that we built the wheels9# for. This can also be done ensured manually by using the tox environment py38-sagewheels etc.)10#11# Afterwards, to test interactively:12#13# pkgs/sagemath-standard/.tox/ENVIRONMENT/bin/python14# pkgs/sagemath-standard/.tox/ENVIRONMENT/bin/sage15#16[tox]17envlist =18# Build and test without using the concrete dependencies specified by requirements.txt,19# using the dependencies declared in pyproject.toml and setup.cfg (install-requires) only:20# Still use ONLY the wheels built and stored by the Sage distribution (no PyPI).21#22# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-sagewheels-nopypi-norequirements)'23#24sagepython-sagewheels-nopypi-norequirements25#26# OTHER SUPPORTED ENVIRONMENTS:27#28# Build dependencies according to requirements.txt (all versions fixed).29# Use ONLY the wheels built and stored by the Sage distribution (no PyPI):30#31# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-sagewheels-nopypi)'32#33# Build and test without using the concrete dependencies specified by requirements.txt,34# using the dependencies declared in pyproject.toml and setup.cfg (install-requires) only:35# Install the distribution packages included in the SageMath monorepository only from36# their source trees in SAGE_ROOT/pkgs/ (not from PyPI).37#38# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-constraints_pkgs-norequirements)'39#40# Build dependencies according to requirements.txt (all versions fixed).41# Install the distribution packages included in the SageMath monorepository only from42# their source trees in SAGE_ROOT/pkgs/ (not from PyPI).43#44# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-constraints_pkgs)'45#46# EXPERIMENTAL ENVIRONMENTS:47#48# Build dependencies according to requirements.txt (all versions fixed).49# Use the wheels built and stored by the Sage distribution,50# and additionally allow packages from PyPI.51# Because all versions are fixed, we "should" end up using the prebuilt wheels.52#53# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-sagewheels)'54#55# Likewise, but using pipenv using Pipfile-dist (= SAGE_ROOT/Pipfile).56# This also fixes the concrete dependencies (at least for some packages).57#58# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-sagewheels-pipenv-dist)'59#60# Build using the dependencies declared in pyproject.toml and setup.cfg (install-requires) only.61# Use the wheels built and stored by the Sage distribution,62# and additionally allow packages from PyPI.63#64# Because the version ranges will allow for packages to come in from PyPI (in source or wheel form),65# this is likely to fail because we do not have control over the configuration of these packages.66#67# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-sagewheels-norequirements)'68#69# Likewise, but using pipenv70#71# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-sagewheels-pipenv)'72#7374requires =75# Auto-provision a modern tox.76# [pkgenv] added in 4.2 - https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance77# Because of https://github.com/tox-dev/tox/issues/3238, need <4.14.178tox>=4.279tox<4.14.18081[pkgenv]82# Environment in which to build the sdist.83# https://tox.wiki/en/latest/upgrading.html#packaging-environments84passenv =85# Variables set by .homebrew-build-env86CPATH87LIBRARY_PATH88PKG_CONFIG_PATH89# Parallel build90SAGE_NUM_THREADS91SAGE_NUM_THREADS_PARALLEL92MAKEFLAGS93# SAGE_VENV only for referring to the basepython or finding the wheels94sagepython, sagewheels: SAGE_VENV95# Used as an environment variable in constraints_pkgs.txt96constraints_pkgs: SAGE_ROOT97# Location of the wheels98sagewheels: SAGE_SPKG_WHEELS99100setenv =101# We supply pip options by environment variables so that they102# apply both to the installation of the dependencies and of the package103sagewheels: PIP_FIND_LINKS=file://{env:SAGE_SPKG_WHEELS:{env:SAGE_VENV:{toxinidir}/../../../../venv}/var/lib/sage/wheels}104nopypi: PIP_NO_INDEX=true105constraints_pkgs: PIP_CONSTRAINT={toxinidir}/constraints_pkgs.txt106# No build isolation for PEP 517 packages - use what is already in the environment107# Note that this pip env "NO" variable uses inverted logic:108# PIP_NO_BUILD_ISOLATION=False means don't use build isolation.109# See https://github.com/conda/conda-build/blob/8f1b3517fd0c816ec78b6dadf4a912b849ecd58a/conda_build/build.py#L2574110nobuildisolation: PIP_NO_BUILD_ISOLATION=false111# Do not write or use Pipfile.lock -- we cannot seem to set its location,112# so we cannot isolate it in the tox environment.113pipenv: PIPENV_SKIP_LOCK=true114115[testenv]116deps =117pipenv: pipenv118!pipenv-!norequirements: -rrequirements.txt119## Needed for fpylll120norequirements: Cython121norequirements: cysignals122123sitepackages =124sitepackages: True125!sitepackages: False126127extras = test128129passenv = {[pkgenv]passenv}130131setenv = {[pkgenv]setenv}132# Sage scripts such as sage-runtests like to use $HOME/.sage133HOME={envdir}134135allowlist_externals =136bash137138# Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package.139# So we change to another directory when running commands.140change_dir = {env_tmp_dir}141142commands =143python -c 'import sage.all; print(sage.all.__file__)'144145# We check that the "sage" script invokes the correct Python.146sage -c 'import sys; print("sys.path =", sys.path); import sage.all; print(sage.all.__file__)'147148sage -t -p --all149150[testenv:.tox]151# Allow access to PyPI for auto-provisioning a suitable tox version152passenv =153setenv = PIP_NO_INDEX=false154155[testenv:.pkg-sagepython]156# Environment in which to build the sdist.157# inherits from [pkgenv] - https://tox.wiki/en/latest/upgrading.html#packaging-environments158basepython = {env:SAGE_VENV}/bin/python3159160[testenv:.pkg-sagepython-sagewheels-nopypi]161passenv = {[pkgenv]passenv}162SAGE_VENV163SAGE_SPKG_WHEELS164165setenv = {[pkgenv]setenv}166PIP_FIND_LINKS=file://{env:SAGE_SPKG_WHEELS:{env:SAGE_VENV:{toxinidir}/../../../../venv}/var/lib/sage/wheels}167PIP_NO_INDEX=true168169basepython = {env:SAGE_VENV}/bin/python3170171[testenv:.pkg-sagepython-constraints_pkgs]172passenv = {[pkgenv]passenv}173SAGE_VENV174# Location of constraints_pkgs.txt175SAGE_ROOT176177setenv = {[pkgenv]setenv}178PIP_CONSTRAINT={env:SAGE_ROOT}/constraints_pkgs.txt179180basepython = {env:SAGE_VENV}/bin/python3181182[testenv:sagepython]183basepython = {env:SAGE_VENV}/bin/python3184package_env = .pkg-sagepython185186[testenv:sagepython-sagewheels-nopypi]187basepython = {env:SAGE_VENV}/bin/python3188package_env = .pkg-sagepython-sagewheels-nopypi189190[testenv:sagepython-sagewheels]191basepython = {env:SAGE_VENV}/bin/python3192package_env = .pkg-sagepython193194[testenv:sagepython-sagewheels-pipenv-dist]195basepython = {env:SAGE_VENV}/bin/python3196package_env = .pkg-sagepython197198[testenv:sagepython-sagewheels-norequirements]199basepython = {env:SAGE_VENV}/bin/python3200package_env = .pkg-sagepython201202[testenv:sagepython-sagewheels-pipenv]203basepython = {env:SAGE_VENV}/bin/python3204package_env = .pkg-sagepython205206[testenv:sagepython-constraints_pkgs]207basepython = {env:SAGE_VENV}/bin/python3208package_env = .pkg-sagepython-constraints_pkgs209210[testenv:sagepython-constraints_pkgs-norequirements]211basepython = {env:SAGE_VENV}/bin/python3212package_env = .pkg-sagepython-constraints_pkgs213214215[testenv:sagepython-sagewheels-nopypi-norequirements]216basepython = {env:SAGE_VENV}/bin/python3217package_env = .pkg-sagepython-sagewheels-nopypi218219220