Skip to content

Commit

Permalink
Do not modify provisioned envdir when --devenv is specified (#2066)
Browse files Browse the repository at this point in the history
Co-authored-by: Isaac Pedisich <ipedisich@grammatech.com>
  • Loading branch information
isaac-ped and Isaac Pedisich committed May 24, 2021
1 parent 67bae1e commit 2a2a964
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Expand Up @@ -47,6 +47,7 @@ Ian Stapleton Cordasco
Igor Duarte Cardoso
Ilya Kulakov
Ionel Maries Cristian
Isaac Pedisich
Itxaka Serrano
Jake Windle
Jannis Leidel
Expand Down
1 change: 1 addition & 0 deletions docs/changelog/2065.bugfix.rst
@@ -0,0 +1 @@
``--devenv`` no longer modifies the directory in which the ``.tox`` environment is provisioned - by :user:`isaac-ped`
5 changes: 4 additions & 1 deletion src/tox/config/__init__.py
Expand Up @@ -595,7 +595,10 @@ def tox_addoption(parser):
)

def _set_envdir_from_devenv(testenv_config, value):
if testenv_config.config.option.devenv is not None:
if (
testenv_config.config.option.devenv is not None
and testenv_config.envname != testenv_config.config.provision_tox_env
):
return py.path.local(testenv_config.config.option.devenv)
else:
return value
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/session/test_provision.py
Expand Up @@ -385,3 +385,20 @@ def space_path2url(path):
if " " not in at_path:
return at_path
return urljoin("file:", pathname2url(os.path.abspath(at_path)))


def test_provision_does_not_occur_in_devenv(newconfig, next_tox_major):
"""Adding --devenv should not change the directory where provisioning occurs"""
with pytest.raises(MissingRequirement) as context:
newconfig(
["--devenv", "my_devenv"],
"""\
[tox]
minversion = {}
""".format(
next_tox_major,
),
)
config = context.value.config
assert config.run_provision is True
assert config.envconfigs[".tox"].envdir.basename != "my_devenv"

0 comments on commit 2a2a964

Please sign in to comment.