Skip to content

Commit

Permalink
Add a Multi-Source Test
Browse files Browse the repository at this point in the history
  • Loading branch information
srilman committed Feb 26, 2023
1 parent fd4d539 commit eb80015
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/test-multi-sources/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dependencies:
- pytest
6 changes: 6 additions & 0 deletions tests/test-multi-sources/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- python <3.11
platforms:
- osx-arm64
- osx-64
- linux-64
18 changes: 18 additions & 0 deletions tests/test-multi-sources/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[tool.poetry]
name = "conda-lock-test-poetry"
version = "0.0.1"
description = ""
authors = ["conda-lock"]

[tool.poetry.dependencies]
pandas = "^1.5.0"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

[tool.conda-lock]
platforms = [
"win-64",
"osx-arm64"
]
12 changes: 12 additions & 0 deletions tests/test_conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
from conda_lock.src_parser import (
DEFAULT_PLATFORMS,
LockSpecification,
_parse_platforms_from_srcs,
parse_meta_yaml_file,
)
from conda_lock.src_parser.aggregation import aggregate_lock_specs
Expand Down Expand Up @@ -215,6 +216,12 @@ def git_metadata_zlib_environment(tmp_path: Path):
return clone_test_dir("zlib", tmp_path).joinpath("environment.yml")


@pytest.fixture
def multi_source_env(tmp_path: Path):
f = clone_test_dir("test-multi-sources", tmp_path)
return [f.joinpath("main.yml"), f.joinpath("pyproject.toml"), f.joinpath("dev.yml")]


@pytest.fixture(
scope="function",
params=[
Expand Down Expand Up @@ -427,6 +434,11 @@ def test_parse_env_file_with_filters_defaults(filter_conda_environment: Path):
)


def test_parse_platforms_from_multi_sources(multi_source_env):
platforms = _parse_platforms_from_srcs(multi_source_env)
assert platforms == ["osx-arm64", "osx-64", "linux-64", "win-64"]


def test_choose_wheel() -> None:
solution = solve_pypi(
{
Expand Down

0 comments on commit eb80015

Please sign in to comment.