diff --git a/tests/test_conda_lock.py b/tests/test_conda_lock.py index d6c64ed8e..05d2dfa2c 100644 --- a/tests/test_conda_lock.py +++ b/tests/test_conda_lock.py @@ -1824,10 +1824,9 @@ def test_aggregate_lock_specs_invalid_pip_repos(): def test_solve_arch_multiple_categories(): _conda_exe = determine_conda_executable(None, mamba=False, micromamba=False) - vpr = default_virtual_package_repodata() channels = [Channel.from_string("conda-forge")] - with vpr, tempfile.NamedTemporaryFile(dir=".") as tf: + with tempfile.NamedTemporaryFile(dir=".") as tf: spec = LockSpecification( dependencies={ "linux-64": [ @@ -1858,10 +1857,18 @@ def test_solve_arch_multiple_categories(): # NB: this file must exist for relative path resolution to work # in create_lockfile_from_spec sources=[Path(tf.name)], - virtual_package_repo=vpr, ) - locked_deps = _solve_for_arch(_conda_exe, spec, "linux-64", channels, []) + vpr = default_virtual_package_repodata() + with vpr: + locked_deps = _solve_for_arch( + conda=_conda_exe, + spec=spec, + platform="linux-64", + channels=channels, + pip_repositories=[], + virtual_package_repo=vpr, + ) python_deps = [dep for dep in locked_deps if dep.name == "python"] assert len(python_deps) == 1 assert python_deps[0].categories == {"main"} @@ -2062,6 +2069,7 @@ def test_install_multiple_subcategories( conda_exe: str, install_multiple_categories_lockfile: Path, categories: List[str], + install_lock, ): root_prefix = tmp_path / "root_prefix" root_prefix.mkdir(exist_ok=True) @@ -2074,7 +2082,7 @@ def test_install_multiple_subcategories( # since by default we do platform validation we would expect this to fail context = pytest.raises(PlatformValidationError) - with context, install_lock(): + with context: install( conda=str(conda_exe), prefix=str(prefix),