Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not modify provisioned envdir when --devenv is specified #2066

Merged
merged 4 commits into from May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"