Skip to content

Commit e60309c

Browse files
committed
Add failing test for conda/pip conflict
Ref: #540
1 parent 795f249 commit e60309c

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# From @jamesmyatt:
2+
# <https://github.com/conda/conda-lock/issues/540#issuecomment-1843018053>
3+
channels:
4+
- conda-forge
5+
platforms:
6+
- linux-64
7+
dependencies:
8+
- python =3.12
9+
- click
10+
- pip:
11+
- click <8

tests/test_conda_lock.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,32 @@ def test_run_lock_relative_source_path(
14521452
assert [p.resolve() for p in src_files] == [environment.resolve()]
14531453

14541454

1455+
@pytest.fixture
1456+
def conda_pip_conflict_environment(tmp_path: Path):
1457+
return clone_test_dir("test-conda-pip-conflict", tmp_path).joinpath(
1458+
"environment.yml"
1459+
)
1460+
1461+
1462+
def test_conda_pip_conflict(
1463+
monkeypatch: pytest.MonkeyPatch,
1464+
conda_pip_conflict_environment: Path,
1465+
conda_exe: str,
1466+
):
1467+
monkeypatch.chdir(conda_pip_conflict_environment.parent)
1468+
if is_micromamba(conda_exe):
1469+
monkeypatch.setenv("CONDA_FLAGS", "-v")
1470+
run_lock([conda_pip_conflict_environment], conda_exe=conda_exe)
1471+
lockfile = parse_conda_lock_file(
1472+
conda_pip_conflict_environment.parent / DEFAULT_LOCKFILE_NAME
1473+
)
1474+
clicks = []
1475+
for package in lockfile.package:
1476+
if package.name == "click":
1477+
clicks.append(package)
1478+
assert len(clicks) == 1
1479+
1480+
14551481
@pytest.fixture
14561482
def test_git_package_environment(tmp_path: Path):
14571483
return clone_test_dir("test-git-package", tmp_path).joinpath("environment.yml")

0 commit comments

Comments
 (0)