From 419b98a9a87384e55ebc16d51e51d3751b12310b Mon Sep 17 00:00:00 2001 From: Claudio Jolowicz Date: Tue, 5 Mar 2024 21:53:21 +0100 Subject: [PATCH] tests: fix test for conda env when conda isn't installed (#794) --- tests/test_sessions.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_sessions.py b/tests/test_sessions.py index 98478a60..ff09e42a 100644 --- a/tests/test_sessions.py +++ b/tests/test_sessions.py @@ -18,6 +18,7 @@ import logging import operator import os +import shutil import sys import tempfile from pathlib import Path @@ -33,6 +34,9 @@ from nox import _options from nox.logger import logger +HAS_CONDA = shutil.which("conda") is not None +has_conda = pytest.mark.skipif(not HAS_CONDA, reason="Missing conda command.") + def test__normalize_path(): envdir = "envdir" @@ -946,7 +950,12 @@ def test__create_venv(self, create): nox.virtualenv.VirtualEnv, ), ("nox.virtualenv.VirtualEnv.create", "venv", nox.virtualenv.VirtualEnv), - ("nox.virtualenv.CondaEnv.create", "conda", nox.virtualenv.CondaEnv), + pytest.param( + "nox.virtualenv.CondaEnv.create", + "conda", + nox.virtualenv.CondaEnv, + marks=has_conda, + ), ], ) def test__create_venv_options(self, create_method, venv_backend, expected_backend):