@@ -565,7 +565,7 @@ def conda_install(
565
565
prefix_args : tuple [str , ...] = ()
566
566
if isinstance (venv , CondaEnv ):
567
567
prefix_args = ("--prefix" , venv .location )
568
- elif not isinstance (venv , PassthroughEnv ): # pragma: no cover
568
+ elif not isinstance (venv , PassthroughEnv ):
569
569
raise ValueError (
570
570
"A session without a conda environment can not install dependencies"
571
571
" from conda."
@@ -574,7 +574,9 @@ def conda_install(
574
574
if not args :
575
575
raise ValueError ("At least one argument required to install()." )
576
576
577
- if self ._runner .global_config .no_install and venv ._reused :
577
+ if self ._runner .global_config .no_install and (
578
+ isinstance (venv , PassthroughEnv ) or venv ._reused
579
+ ):
578
580
return
579
581
580
582
# Escape args that should be (conda-specific; pip install does not need this)
@@ -648,6 +650,8 @@ def install(self, *args: str, **kwargs: Any) -> None:
648
650
"A session without a virtualenv can not install dependencies."
649
651
)
650
652
if isinstance (venv , PassthroughEnv ):
653
+ if self ._runner .global_config .no_install :
654
+ return
651
655
raise ValueError (
652
656
f"Session { self .name } does not have a virtual environment, so use of"
653
657
" session.install() is no longer allowed since it would modify the"
0 commit comments