Skip to content

Commit

Permalink
Add failing test for conda/pip conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Dec 10, 2023
1 parent a301e96 commit a7eb669
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test-conda-pip-conflict/environment.yml
@@ -0,0 +1,11 @@
# From @jamesmyatt:
# <https://github.com/conda/conda-lock/issues/540#issuecomment-1843018053>
channels:
- conda-forge
platforms:
- linux-64
dependencies:
- python =3.12
- click
- pip:
- click <8
26 changes: 26 additions & 0 deletions tests/test_conda_lock.py
Expand Up @@ -1452,6 +1452,32 @@ def test_run_lock_relative_source_path(
assert [p.resolve() for p in src_files] == [environment.resolve()]


@pytest.fixture
def conda_pip_conflict_environment(tmp_path: Path):
return clone_test_dir("test-conda-pip-conflict", tmp_path).joinpath(
"environment.yml"
)


def test_conda_pip_conflict(
monkeypatch: pytest.MonkeyPatch,
conda_pip_conflict_environment: Path,
conda_exe: str,
):
monkeypatch.chdir(conda_pip_conflict_environment.parent)
if is_micromamba(conda_exe):
monkeypatch.setenv("CONDA_FLAGS", "-v")
run_lock([conda_pip_conflict_environment], conda_exe=conda_exe)
lockfile = parse_conda_lock_file(
conda_pip_conflict_environment.parent / DEFAULT_LOCKFILE_NAME
)
clicks = []
for package in lockfile.package:
if package.name == "click":
clicks.append(package)
assert len(clicks) == 1


@pytest.fixture
def test_git_package_environment(tmp_path: Path):
return clone_test_dir("test-git-package", tmp_path).joinpath("environment.yml")
Expand Down

0 comments on commit a7eb669

Please sign in to comment.