From 03508844f3a5c152dd16d9106d378b2f55616d6d Mon Sep 17 00:00:00 2001 From: Tom Fleet Date: Mon, 12 Jul 2021 18:32:40 +0100 Subject: [PATCH] Conda logs now respect nox.options.verbose. Fixes #345 --- nox/virtualenv.py | 5 +++-- tests/test_virtualenv.py | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/nox/virtualenv.py b/nox/virtualenv.py index a6bf8448..9bf80927 100644 --- a/nox/virtualenv.py +++ b/nox/virtualenv.py @@ -22,6 +22,7 @@ import py +import nox import nox.command from nox.logger import logger @@ -250,7 +251,7 @@ def create(self) -> bool: logger.info( "Creating conda env in {} with {}".format(self.location_name, python_dep) ) - nox.command.run(cmd, silent=True, log=False) + nox.command.run(cmd, silent=True, log=nox.options.verbose or False) return True @@ -473,6 +474,6 @@ def create(self) -> bool: self.location_name, ) ) - nox.command.run(cmd, silent=True, log=False) + nox.command.run(cmd, silent=True, log=nox.options.verbose or False) return True diff --git a/tests/test_virtualenv.py b/tests/test_virtualenv.py index c85c08bc..8fe1c410 100644 --- a/tests/test_virtualenv.py +++ b/tests/test_virtualenv.py @@ -210,6 +210,23 @@ def test_condaenv_create_interpreter(make_conda): assert dir_.join("bin", "python3.7").check() +@pytest.mark.skipif(not HAS_CONDA, reason="Missing conda command.") +def test_conda_env_create_verbose(make_conda): + venv, dir_ = make_conda() + with mock.patch("nox.virtualenv.nox.command.run") as mock_run: + venv.create() + + args, kwargs = mock_run.call_args + assert kwargs["log"] is False + + nox.options.verbose = True + with mock.patch("nox.virtualenv.nox.command.run") as mock_run: + venv.create() + + args, kwargs = mock_run.call_args + assert kwargs["log"] + + @mock.patch("nox.virtualenv._SYSTEM", new="Windows") def test_condaenv_bin_windows(make_conda): venv, dir_ = make_conda()