Skip to content

Commit

Permalink
tests: fix issues and add a simple mamba test
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Dec 17, 2021
1 parent 558ab0e commit 8c9e374
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 1 addition & 3 deletions nox/virtualenv.py
Expand Up @@ -156,9 +156,7 @@ class PassthroughEnv(ProcessEnv):
hints about the actual env.
"""

@property
def conda_cmd(self) -> str:
return "conda"
conda_cmd = "conda"

@staticmethod
def is_offline() -> bool:
Expand Down
8 changes: 6 additions & 2 deletions tests/test_sessions.py
Expand Up @@ -384,7 +384,8 @@ def test_conda_install_not_a_condaenv(self):
"auto_offline", [False, True], ids="auto_offline={}".format
)
@pytest.mark.parametrize("offline", [False, True], ids="offline={}".format)
def test_conda_install(self, auto_offline, offline):
@pytest.mark.parametrize("conda", ["conda", "mamba"], ids=str)
def test_conda_install(self, auto_offline, offline, conda):
runner = nox.sessions.SessionRunner(
name="test",
signatures=["test"],
Expand All @@ -396,6 +397,7 @@ def test_conda_install(self, auto_offline, offline):
runner.venv.location = "/path/to/conda/env"
runner.venv.env = {}
runner.venv.is_offline = lambda: offline
runner.venv.conda_cmd = conda

class SessionNoSlots(nox.sessions.Session):
pass
Expand All @@ -406,7 +408,7 @@ class SessionNoSlots(nox.sessions.Session):
args = ("--offline",) if auto_offline and offline else ()
session.conda_install("requests", "urllib3", auto_offline=auto_offline)
run.assert_called_once_with(
"conda",
conda,
"install",
"--yes",
*args,
Expand Down Expand Up @@ -434,6 +436,7 @@ def test_conda_venv_reused_with_no_install(self, no_install, reused, run_called)
runner.venv.location = "/path/to/conda/env"
runner.venv.env = {}
runner.venv.is_offline = lambda: True
runner.venv.conda_cmd = "conda"

runner.global_config.no_install = no_install
runner.venv._reused = reused
Expand All @@ -460,6 +463,7 @@ def test_conda_install_non_default_kwargs(self, version_constraint):
runner.venv.location = "/path/to/conda/env"
runner.venv.env = {}
runner.venv.is_offline = lambda: False
runner.venv.conda_cmd = "conda"

class SessionNoSlots(nox.sessions.Session):
pass
Expand Down

0 comments on commit 8c9e374

Please sign in to comment.