diff --git a/nox/sessions.py b/nox/sessions.py index a1693966..754a2e74 100644 --- a/nox/sessions.py +++ b/nox/sessions.py @@ -508,6 +508,12 @@ def install(self, *args: str, **kwargs: Any) -> None: session.install('-e', '.') Additional keyword args are the same as for :meth:`run`. + + .. warning:: + + Running ``session.install`` without a virtual environment + is no longer supported. If you still want to do that, please + use ``session.run("pip", "install", ...)`` instead. .. _pip: https://pip.readthedocs.org """ @@ -520,13 +526,11 @@ def install(self, *args: str, **kwargs: Any) -> None: "A session without a virtualenv can not install dependencies." ) if isinstance(venv, PassthroughEnv): - warnings.warn( + self.error( f"Session {self.name} does not have a virtual environment, " - "so use of session.install() is deprecated since it would modify " + "so use of session.install() is not allowed since it would modify " "the global Python environment. If you're really sure that is " 'what you want to do, use session.run("pip", "install", ...) instead.', - category=FutureWarning, - stacklevel=2, ) if not args: raise ValueError("At least one argument required to install().")