diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 38e8700e0..8a6e9cba5 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -47,6 +47,7 @@ Ian Stapleton Cordasco Igor Duarte Cardoso Ilya Kulakov Ionel Maries Cristian +Isaac Pedisich Itxaka Serrano Jake Windle Jannis Leidel diff --git a/docs/changelog/2065.bugfix.rst b/docs/changelog/2065.bugfix.rst new file mode 100644 index 000000000..ecb90308e --- /dev/null +++ b/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` diff --git a/src/tox/config/__init__.py b/src/tox/config/__init__.py index b014d7751..8f03f3647 100644 --- a/src/tox/config/__init__.py +++ b/src/tox/config/__init__.py @@ -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 diff --git a/tests/unit/session/test_provision.py b/tests/unit/session/test_provision.py index cf2ded108..ad9f2310f 100644 --- a/tests/unit/session/test_provision.py +++ b/tests/unit/session/test_provision.py @@ -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"