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

Correct bin paths in CondaEnv for Windows #535

Merged
merged 3 commits into from Dec 26, 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
11 changes: 9 additions & 2 deletions nox/virtualenv.py
Expand Up @@ -231,9 +231,16 @@ def _clean_location(self) -> bool:
@property
def bin_paths(self) -> List[str]:
"""Returns the location of the conda env's bin folder."""
# see https://docs.anaconda.com/anaconda/user-guide/tasks/integration/python-path/#examples
# see https://github.com/conda/conda/blob/f60f0f1643af04ed9a51da3dd4fa242de81e32f4/conda/activate.py#L563-L572
if _SYSTEM == "Windows":
return [self.location, os.path.join(self.location, "Scripts")]
return [
self.location,
os.path.join(self.location, "Library", "mingw-w64", "bin"),
os.path.join(self.location, "Library", "usr", "bin"),
os.path.join(self.location, "Library", "bin"),
os.path.join(self.location, "Scripts"),
os.path.join(self.location, "bin"),
]
else:
return [os.path.join(self.location, "bin")]

Expand Down
9 changes: 8 additions & 1 deletion tests/test_virtualenv.py
Expand Up @@ -230,7 +230,14 @@ def test_conda_env_create_verbose(make_conda):
@mock.patch("nox.virtualenv._SYSTEM", new="Windows")
def test_condaenv_bin_windows(make_conda):
venv, dir_ = make_conda()
assert [dir_.strpath, dir_.join("Scripts").strpath] == venv.bin_paths
assert [
dir_.strpath,
dir_.join("Library", "mingw-w64", "bin").strpath,
dir_.join("Library", "usr", "bin").strpath,
dir_.join("Library", "bin").strpath,
dir_.join("Scripts").strpath,
dir_.join("bin").strpath,
] == venv.bin_paths


@pytest.mark.skipif(not HAS_CONDA, reason="Missing conda command.")
Expand Down