-
-
Notifications
You must be signed in to change notification settings - Fork 541
Description
if you have a python package to test with tox and using a constraints.txt to pin versions for specific dependencies tox4 will read the constraints.txt and add each line to the pip install command as a dependency.
Following https://tox.readthedocs.io/en/latest/example/basic.html#depending-on-requirements-txt-or-defining-constraints is misleading or wrong at that moment.
tox.ini
[tox]
envlist =
py36,
py37,
py38,
py39,
docs,
isort,
lint,
coverage,
skip_missing_interpreters = False
[testenv]
usedevelop = True
extras =
test
commands =
python -VV
pip list
pytest --cov=src --cov=tests --cov-report=xml --html=_build/pytest/report-{envname}.html --self-contained-html {posargs}
setenv =
COVERAGE_FILE=.coverage.{envname}
deps =
-cconstraints.txt
pytest-cov
pytest-htmlconstraints.txt
# Constraints for Python Packages
# -----------------------------------------------
# Pin Versions / Version Ranges if necessary.
pytest > 6
results in an output line:
py36: 14582 W install_deps> python -I -m pip install pytest-cov pytest-html 'pytest>6' [tox/tox_env/api.py:288]For
deps =
-requirements.txt
-cconstraints.txt
pytest-cov
pytest-htmlsuggested or expected command should be:
python -I -m pip install -U -r requirements.txt -c constraints.txt listeded-dependenciesor even better to read:
python -I -m pip install --upgrade --requirement requirements.txt --constraint constraints.txt listeded-dependenciesBackground:
Constraints files may specify version pins or ranges for packages that might be used in this context. Those packages could be optional. In contrast to requirement files, where all declared packages are dependencies and must be met / installed with the specified pinned version.
Constraints files may be used as a definition of known good version set that works with a specific major release of a package.
Example:
[tox]
envlist =
py{36,37,38,39}-MyProduct{4.0,4.1,4.2,5.0},
docs,
isort,
lint,
coverage,
[testenv]
usedevelop = True
extras =
test
commands =
python -VV
pip list
pytest --cov=src --cov=tests --cov-report=xml --html=_build/pytest/report-{envname}.html --self-contained-html {posargs}
setenv =
COVERAGE_FILE=.coverage.{envname}
deps =
-chttps://myproduct-index-server/releases/{envname}/constraints.txt
MyProduct