Skip to content

Commit

Permalink
Add failing test that shows when vcs is intalled by the commit hash t…
Browse files Browse the repository at this point in the history
…he ref is null
  • Loading branch information
matteius committed Oct 25, 2024
1 parent 1d2b20d commit 618aa5f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pipenv/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def uninstall(ctx, state, all_dev=False, all=False, **kwargs):
all=all,
pre=pre,
pypi_mirror=state.pypi_mirror,
pipfile_categories=state.installstate.categories,
categories=state.installstate.categories,
ctx=ctx,
)
if retcode:
Expand Down
3 changes: 1 addition & 2 deletions pipenv/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import os
import sys
from dataclasses import dataclass, field
from functools import cached_property
from pathlib import Path
from typing import Any, Dict, List, Optional, Set

Expand Down Expand Up @@ -228,7 +227,7 @@ def _get_pipfile_content(self) -> Dict[str, Any]:

return tomlkit_value_to_python(self.project.parsed_pipfile.get(self.category, {}))

@cached_property
@property
def get_cleaned_dict(self) -> Dict[str, Any]:
"""Create a cleaned dictionary representation of the entry."""
cleaned = {
Expand Down
28 changes: 28 additions & 0 deletions tests/integration/test_install_vcs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from pathlib import Path

import pytest

Expand Down Expand Up @@ -43,3 +44,30 @@ def test_install_github_vcs_with_credentials(pipenv_instance_pypi, use_credentia
# Verify that the package is installed and usable
c = p.pipenv("run python -c \"import dataclass_factory\"")
assert c.returncode == 0, f"Failed to import library: {c.stderr}"


@pytest.mark.vcs
@pytest.mark.urls
@pytest.mark.install
@pytest.mark.needs_internet
def test_install_vcs_ref_by_commit_hash(pipenv_instance_private_pypi):
with pipenv_instance_private_pypi() as p:
c = p.pipenv("install -e git+https://github.com/benjaminp/six.git@5efb522b0647f7467248273ec1b893d06b984a59@#egg=six")
assert c.returncode == 0
assert "six" in p.pipfile["packages"]
assert "six" in p.lockfile["default"]
assert (
p.lockfile["default"]["six"]["ref"]
== "5efb522b0647f7467248273ec1b893d06b984a59"
)
pipfile = Path(p.pipfile_path)
new_content = pipfile.read_text().replace("5efb522b0647f7467248273ec1b893d06b984a59", "15e31431af97e5e64b80af0a3f598d382bcdd49a")
pipfile.write_text(new_content)
c = p.pipenv("lock")
assert c.returncode == 0
assert (
p.lockfile["default"]["six"]["ref"]
== "15e31431af97e5e64b80af0a3f598d382bcdd49a"
)
assert "six" in p.pipfile["packages"]
assert "six" in p.lockfile["default"]

0 comments on commit 618aa5f

Please sign in to comment.