Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Sep 13, 2024
1 parent 7f3195b commit dd8e2a4
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tests/test_conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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"}
Expand Down Expand Up @@ -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)
Expand All @@ -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),
Expand Down

0 comments on commit dd8e2a4

Please sign in to comment.