Skip to content

Commit

Permalink
Removes automatic reuse of venvs when no-install is provided (wntrblm…
Browse files Browse the repository at this point in the history
…#394)

Also reduces log verbosity by only noting package reinstallation
when venv is not explicitly reused.
  • Loading branch information
gwynforthewyn committed May 7, 2021
1 parent 36a1e41 commit 31529de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ The following options can be specified in the Noxfile:
* ``nox.options.default_venv_backend`` is equivalent to specifying :ref:`-db or --default-venv-backend <opt-default-venv-backend>`.
* ``nox.options.force_venv_backend`` is equivalent to specifying :ref:`-fb or --force-venv-backend <opt-force-venv-backend>`.
* ``nox.options.reuse_existing_virtualenvs`` is equivalent to specifying :ref:`--reuse-existing-virtualenvs <opt-reuse-existing-virtualenvs>`. You can force this off by specifying ``--no-reuse-existing-virtualenvs`` during invocation.
* ``nox.options.no_install`` is equivalent to specifying :ref:`--no-install <opt-no-install>`.
* ``nox.options.stop_on_first_error`` is equivalent to specifying :ref:`--stop-on-first-error <opt-stop-on-first-error>`. You can force this off by specifying ``--no-stop-on-first-error`` during invocation.
* ``nox.options.error_on_missing_interpreters`` is equivalent to specifying :ref:`--error-on-missing-interpreters <opt-error-on-missing-interpreters>`. You can force this off by specifying ``--no-error-on-missing-interpreters`` during invocation.
* ``nox.options.error_on_external_run`` is equivalent to specifying :ref:`--error-on-external-run <opt-error-on-external-run>`. You can force this off by specifying ``--no-error-on-external-run`` during invocation.
Expand Down
18 changes: 9 additions & 9 deletions nox/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,10 @@ def conda_install(
)
return None
else:
logger.info(
"Venv not created yet: ignoring --no-install and installing from conda."
)
if not self._runner.global_config.reuse_existing_virtualenvs:
logger.info(
"Venv not created yet: ignoring --no-install and installing from conda."
)

# Escape args that should be (conda-specific; pip install does not need this)
args = _dblquote_pkg_install_args(args)
Expand Down Expand Up @@ -450,9 +451,10 @@ def install(self, *args: str, **kwargs: Any) -> None:
)
return None
else:
logger.info(
"Venv not created yet: ignoring --no-install and installing."
)
if not self._runner.global_config.reuse_existing_virtualenvs:
logger.info(
"Venv not created yet: ignoring --no-install and installing."
)

if "silent" not in kwargs:
kwargs["silent"] = True
Expand Down Expand Up @@ -544,9 +546,7 @@ def _create_venv(self) -> None:
return

reuse_existing = (
self.func.reuse_venv
or self.global_config.reuse_existing_virtualenvs
or self.global_config.no_install
self.func.reuse_venv or self.global_config.reuse_existing_virtualenvs
)

if backend is None or backend == "virtualenv":
Expand Down

0 comments on commit 31529de

Please sign in to comment.