From 8c9e374c996e7473e11afd55b8eac48866ad6f9d Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 17 Dec 2021 15:59:30 -0500 Subject: [PATCH] tests: fix issues and add a simple mamba test --- nox/virtualenv.py | 4 +--- tests/test_sessions.py | 8 ++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/nox/virtualenv.py b/nox/virtualenv.py index f5b4b37c..501118f9 100644 --- a/nox/virtualenv.py +++ b/nox/virtualenv.py @@ -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: diff --git a/tests/test_sessions.py b/tests/test_sessions.py index 6bcd916d..a7d16425 100644 --- a/tests/test_sessions.py +++ b/tests/test_sessions.py @@ -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"], @@ -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 @@ -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, @@ -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 @@ -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