Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing test for conda/pip conflict #569

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/test-conda-pip-conflict/environment.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,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
Loading