Skip to content

Allow for base deps, overridden by factors (no duplicate requirements) #1390

@blueyed

Description

@blueyed

Often you have special factors with specific version constraints for dependencies.

With pytest-cov this then results in tox -e py37 not working, since dependencies are not installed then.

It would be nice if this would be supported:

diff --git i/tox.ini w/tox.ini
index bfe166f..b640c23 100644
--- i/tox.ini
+++ w/tox.ini
@@ -13,6 +13,7 @@ setenv =
 passenv =
     *
 deps =
+    pytest
     t310: pytest==3.10.1
     t40: pytest==4.0.2
     t41: pytest==4.1.1
@@ -20,9 +21,11 @@ deps =
     t44: pytest==4.4.2
     t45: pytest==4.5.0

+    pytest-xdist
     {t310,t40,t41,t43}: pytest-xdist==1.27.0
     {t44,t45}: pytest-xdist==1.28.0

+    coverage
     c44: coverage==4.4.2
     c45: coverage==4.5.3
 pip_pre = true

I.e. the deps are installed without a version constraint by default, but for the specific factors the constraint would be used.

Currently this results in:

GLOB sdist-make: /home/daniel/Vcs/pytest-cov/setup.py
py37-t45 create: /home/daniel/Vcs/pytest-cov/.tox/py37-t45
py37-t45 installdeps: pytest, pytest==4.5.0, pytest-xdist, pytest-xdist==1.28.0, coverage
ERROR: invocation failed (exit code 1), logfile: /home/daniel/Vcs/pytest-cov/.tox/py37-t45/log/py37-t45-1.log
================================================================================= log start ==================================================================================
Double requirement given: pytest==4.5.0 (already in pytest, name='pytest')
You are using pip version 19.0.3, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

================================================================================== log end ===================================================================================
ERROR: could not install deps [pytest, pytest==4.5.0, pytest-xdist, pytest-xdist==1.28.0, coverage]; v = InvocationError('/home/daniel/Vcs/pytest-cov/.tox/py37-t45/bin/python -m pip install --pre pytest pytest==4.5.0 pytest-xdist pytest-xdist==1.28.0 coverage', 1)
__________________________________________________________________________________ summary ___________________________________________________________________________________
ERROR:   py37-t45: could not install deps [pytest, pytest==4.5.0, pytest-xdist, pytest-xdist==1.28.0, coverage]; v = InvocationError('/home/daniel/Vcs/pytest-cov/.tox/py37-t45/bin/python -m pip install --pre pytest pytest==4.5.0 pytest-xdist pytest-xdist==1.28.0 coverage', 1)

A trick is to use envs for this, but that should not be necessary: pytest-dev/pytest-cov#315

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:newsomething does not exist yet, but should

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions