Skip to content

Commit 9b8efe2

Browse files
committed
Add failing test for conda/pip conflict
Ref: #540
1 parent 0837772 commit 9b8efe2

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
@@ -1478,6 +1478,32 @@ def test_run_lock_relative_source_path(
14781478
assert [p.resolve() for p in src_files] == [environment.resolve()]
14791479

14801480

1481+
@pytest.fixture
1482+
def conda_pip_conflict_environment(tmp_path: Path):
1483+
return clone_test_dir("test-conda-pip-conflict", tmp_path).joinpath(
1484+
"environment.yml"
1485+
)
1486+
1487+
1488+
def test_conda_pip_conflict(
1489+
monkeypatch: pytest.MonkeyPatch,
1490+
conda_pip_conflict_environment: Path,
1491+
conda_exe: str,
1492+
):
1493+
monkeypatch.chdir(conda_pip_conflict_environment.parent)
1494+
if is_micromamba(conda_exe):
1495+
monkeypatch.setenv("CONDA_FLAGS", "-v")
1496+
run_lock([conda_pip_conflict_environment], conda_exe=conda_exe)
1497+
lockfile = parse_conda_lock_file(
1498+
conda_pip_conflict_environment.parent / DEFAULT_LOCKFILE_NAME
1499+
)
1500+
clicks = []
1501+
for package in lockfile.package:
1502+
if package.name == "click":
1503+
clicks.append(package)
1504+
assert len(clicks) == 1
1505+
1506+
14811507
@pytest.fixture
14821508
def test_git_package_environment(tmp_path: Path):
14831509
return clone_test_dir("test-git-package", tmp_path).joinpath("environment.yml")

0 commit comments

Comments
 (0)