Skip to content

Commit

Permalink
Conda logs now respect nox.options.verbose. (#466)
Browse files Browse the repository at this point in the history
Fixes #345
  • Loading branch information
FollowTheProcess authored Sep 9, 2021
1 parent 5f9cffa commit 2821216
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nox/virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import py

import nox
import nox.command
from nox.logger import logger

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
17 changes: 17 additions & 0 deletions tests/test_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 2821216

Please sign in to comment.