-
-
Couldn't load subscription status.
- Fork 1.9k
PEP660 editable VCS dependencies not reinstalled correctly #6362
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
Draft
matteius
wants to merge
7
commits into
main
Choose a base branch
from
issue-6348
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cf76dbf
Fix issue where editable requirements are not reinstalled
matteius ab60995
Add new tests
matteius 75fca1f
Fix issue where editable requirements are not reinstalled
matteius 69086d6
Merge branch 'main' into issue-6348
matteius a76baf3
PR feedback
matteius c7d11a6
fix ruff
matteius b46da71
add news fragment
matteius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import os | ||
| import shutil | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
| from pipenv.utils.processes import subprocess_run | ||
|
|
||
|
|
||
| @pytest.mark.integration | ||
| @pytest.mark.install | ||
| @pytest.mark.editable | ||
| @pytest.mark.vcs | ||
| def test_editable_vcs_reinstall(pipenv_instance_private_pypi): | ||
| """Test that editable VCS dependencies are reinstalled when the source checkout is missing.""" | ||
| with pipenv_instance_private_pypi() as p: | ||
| # Create a Pipfile with an editable VCS dependency | ||
| with open(p.pipfile_path, "w") as f: | ||
| f.write(""" | ||
| [[source]] | ||
| url = "https://pypi.org/simple" | ||
| verify_ssl = true | ||
| name = "pypi" | ||
|
|
||
| [packages] | ||
| gunicorn = {git = "https://github.com/benoitc/gunicorn", ref = "23.0.0", editable = true} | ||
| """.strip()) | ||
|
|
||
| # Install the dependency | ||
| c = p.pipenv("install") | ||
| assert c.returncode == 0, f"Failed to install: {c.stderr}" | ||
|
|
||
| # Verify the src directory was created | ||
| src_dir = Path(p.path) / "src" | ||
| assert src_dir.exists(), "src directory was not created" | ||
| assert any(src_dir.iterdir()), "src directory is empty" | ||
|
|
||
| # Import the package to verify it's installed correctly | ||
| c = p.pipenv("run python -c 'import gunicorn'") | ||
| assert c.returncode == 0, f"Failed to import gunicorn: {c.stderr}" | ||
|
|
||
| # Remove the src directory to simulate the issue | ||
| shutil.rmtree(src_dir) | ||
| assert not src_dir.exists(), "Failed to remove src directory" | ||
|
|
||
| # Run pipenv install again to see if it reinstalls the dependency | ||
| c = p.pipenv("install") | ||
| assert c.returncode == 0, f"Failed to reinstall: {c.stderr}" | ||
|
|
||
| # Verify the src directory was recreated | ||
| assert src_dir.exists(), "src directory was not recreated" | ||
| assert any(src_dir.iterdir()), "recreated src directory is empty" | ||
|
|
||
| # Import the package again to verify it's reinstalled correctly | ||
| c = p.pipenv("run python -c 'import gunicorn'") | ||
| assert c.returncode == 0, f"Failed to import gunicorn after reinstall: {c.stderr}" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.