-
-
Notifications
You must be signed in to change notification settings - Fork 611
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2087 from macro1/relative-paths
Preserve relative paths for editable dependencies in output
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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,29 @@ | ||
from __future__ import annotations | ||
|
||
import os | ||
import tempfile | ||
from pathlib import Path, PurePosixPath | ||
|
||
import pytest | ||
|
||
from piptools._compat.pip_compat import parse_requirements | ||
from piptools.repositories import PyPIRepository | ||
|
||
from .constants import PACKAGES_RELATIVE_PATH | ||
|
||
|
||
def test_parse_requirements_preserve_editable_relative_path(tmp_path, repository): | ||
test_package_path = str( | ||
PurePosixPath(Path(PACKAGES_RELATIVE_PATH)) / "small_fake_a" | ||
) | ||
requirements_in_path = str(tmp_path / "requirements.in") | ||
|
||
with open(requirements_in_path, "w") as requirements_in_file: | ||
requirements_in_file.write(f"-e {test_package_path}") | ||
|
||
[install_requirement] = parse_requirements( | ||
requirements_in_path, session=repository.session | ||
) | ||
|
||
assert install_requirement.link.url == test_package_path | ||
assert install_requirement.link.file_path == test_package_path |