Skip to content

Commit

Permalink
Treat all return paths of this method as strings (#6017)
Browse files Browse the repository at this point in the history
* Treat all return paths of this method as strings (with test)
  • Loading branch information
matteius committed Nov 15, 2023
1 parent acbcdcc commit 85ba107
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/6017.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix regression with path installs on most recent release ``2023.11.14``
4 changes: 2 additions & 2 deletions pipenv/utils/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,11 +667,11 @@ def ensure_path_is_relative(file_path):
# Check if the paths are on different drives
if abs_path.drive != current_dir.drive:
# If on different drives, return the absolute path
return abs_path
return str(abs_path)

try:
# Try to create a relative path
return abs_path.relative_to(current_dir)
return str(abs_path.relative_to(current_dir))
except ValueError:
# If the direct relative_to fails, manually compute the relative path
common_parts = 0
Expand Down
29 changes: 29 additions & 0 deletions tests/integration/test_install_twists.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,35 @@
from pipenv.utils.shell import temp_environ


@pytest.mark.extras
@pytest.mark.install
@pytest.mark.local
def test_local_path_issue_6016(pipenv_instance_pypi):
with pipenv_instance_pypi() as p:
setup_py = os.path.join(p.path, "setup.py")
with open(setup_py, "w") as fh:
contents = """
from setuptools import setup, find_packages
setup(
name='testpipenv',
version='0.1',
description='Pipenv Test Package',
author='Pipenv Test',
author_email='test@pipenv.package',
license='MIT',
packages=find_packages(),
install_requires=[],
extras_require={'dev': ['six']},
zip_safe=False
)
""".strip()
fh.write(contents)
# project.write_toml({"packages": pipfile, "dev-packages": {}})
c = p.pipenv("install .")
assert c.returncode == 0
assert "testpipenv" in p.lockfile["default"]


@pytest.mark.extras
@pytest.mark.install
@pytest.mark.local
Expand Down

0 comments on commit 85ba107

Please sign in to comment.