Skip to content

Ability to share tox environments within a project #425

@apteryks

Description

@apteryks

Reproducing Steps

  1. Save the following configuration in a "tox.ini" somewhere. Note that the "envdir" is commented out for now.
[tox]
skipsdist = True
envlist = py27,pylint

[testenv]
deps =
    pytest
    pylint
commands =
    pytest --version

[testenv:pylint]
#envdir = {toxworkdir}/py27
commands = pylint --version
  1. In the same directory of this newly created tox.ini file, execute tox twice (tox). The output should look like that:

py27 installed: astroid==1.4.8,backports.functools-lru-cache==1.3,configparser==3.5.0,isort==4.2.5,lazy-object-proxy==1.2.2,mccabe==0.5.2,py==1.4.31,pylint==1.6.4,pytest==3.0.5,six==1.10.0,wrapt==1.10.8
py27 runtests: PYTHONHASHSEED='2007619177'
py27 runtests: commands[0] | pytest --version
This is pytest version 3.0.5, imported from /home/mcournoyer/workspace/test_proj/.tox/py27/lib/python2.7/site-packages/pytest.pyc
pylint installed: astroid==1.4.8,backports.functools-lru-cache==1.3,configparser==3.5.0,isort==4.2.5,lazy-object-proxy==1.2.2,mccabe==0.5.2,py==1.4.31,pylint==1.6.4,pytest==3.0.5,six==1.10.0,wrapt==1.10.8
pylint runtests: PYTHONHASHSEED='2007619177'
pylint runtests: commands[0] | pylint --version
No config file found, using default configuration
pylint 1.6.4,
astroid 1.4.8
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4]
_____________________________________________________ summary ______________________________________________________
py27: commands succeeded
pylint: commands succeeded
congratulations :)

real 0m2.066s
user 0m1.804s
sys 0m0.224s

  1. Now uncomment the line "#envdir = {toxworkdir}/py27" in the tox.ini file and save it, and rerun tox twice. The output should now look like:

py27 recreate: /home/mcournoyer/workspace/test_proj/.tox/py27
py27 installdeps: pytest, pylint
py27 installed: astroid==1.4.8,backports.functools-lru-cache==1.3,configparser==3.5.0,isort==4.2.5,lazy-object-proxy==1.2.2,mccabe==0.5.2,py==1.4.31,pylint==1.6.4,pytest==3.0.5,six==1.10.0,wrapt==1.10.8
py27 runtests: PYTHONHASHSEED='809406144'
py27 runtests: commands[0] | pytest --version
This is pytest version 3.0.5, imported from /home/mcournoyer/workspace/test_proj/.tox/py27/lib/python2.7/site-packages/pytest.pyc
pylint recreate: /home/mcournoyer/workspace/test_proj/.tox/py27
pylint installdeps: pytest, pylint
pylint installed: astroid==1.4.8,backports.functools-lru-cache==1.3,configparser==3.5.0,isort==4.2.5,lazy-object-proxy==1.2.2,mccabe==0.5.2,py==1.4.31,pylint==1.6.4,pytest==3.0.5,six==1.10.0,wrapt==1.10.8
pylint runtests: PYTHONHASHSEED='809406144'
pylint runtests: commands[0] | pylint --version
No config file found, using default configuration
pylint 1.6.4,
astroid 1.4.8
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4]
_____________________________________________________ summary ______________________________________________________
py27: commands succeeded
pylint: commands succeeded
congratulations :)

real 0m11.402s
user 0m9.856s
sys 0m1.440s

  1. Observe that, when reusing the same envdir, the environment always gets recreated (and takes more time to do so) even though the two targets (pytest & pylint) share the exact same requirements.

System Information

OS: Ubuntu 14.04
tox version: 2.5.0
Python version: 2.7.12
pip list: Too many to list here (can provide upon request).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:configurationarea:testenv-creationhelp:wantedIssues that have been acknowledged, a solution determined and a PR might likely be accepted.level:hardrought estimate that this might be quite hard to implement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions