Skip to content

Commit

Permalink
tests: add one more test for coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Mar 7, 2024
1 parent 2e06271 commit 4379325
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/test_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from __future__ import annotations

import functools
import os
import re
import shutil
Expand Down Expand Up @@ -52,14 +53,11 @@ class TextProcessResult(NamedTuple):
def make_one(tmpdir):
def factory(*args, venv_backend: str = "virtualenv", **kwargs):
location = tmpdir.join("venv")
if venv_backend in {"mamba", "conda"}:
venv = nox.virtualenv.CondaEnv(
location.strpath, *args, conda_cmd=venv_backend, **kwargs
)
else:
venv = nox.virtualenv.VirtualEnv(
location.strpath, *args, venv_backend=venv_backend, **kwargs
)
try:
venv_fn = nox.virtualenv.ALL_VENVS[venv_backend]
except KeyError:
venv_fn = functools.partial(nox.virtualenv.VirtualEnv, venv_backend=venv_backend)
venv = venv_fn(location.strpath, *args, **kwargs)
return (venv, location)

return factory
Expand Down Expand Up @@ -499,6 +497,12 @@ def test_stale_environment(make_one, frm, to, result, monkeypatch):
assert reused == result


def test_passthrough_environment_venv_backend():
venv, _ = make_one(reuse_existing=True, venv_backend="none")
venv.create()
assert venv.venv_backend == "none"


@has_uv
def test_create_reuse_stale_virtualenv_environment(make_one, monkeypatch):
monkeypatch.setenv("NOX_ENABLE_STALENESS_CHECK", "1")
Expand Down

0 comments on commit 4379325

Please sign in to comment.