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 2 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
2 changes: 1 addition & 1 deletion src/tox/config/__init__.py
Expand Up @@ -595,7 +595,7 @@ 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 != ".tox":
isaac-ped marked this conversation as resolved.
Show resolved Hide resolved
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"