-
-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Micah Denbraver
committed
May 7, 2024
1 parent
f83bd91
commit 84fda5b
Showing
2 changed files
with
34 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from __future__ import annotations | ||
|
||
import os | ||
import tempfile | ||
|
||
import pytest | ||
|
||
from piptools._compat.pip_compat import parse_requirements | ||
from piptools.repositories import PyPIRepository | ||
|
||
from .constants import PACKAGES_RELATIVE_PATH | ||
|
||
|
||
@pytest.fixture | ||
def repository(): | ||
with tempfile.TemporaryDirectory() as cache_dir: | ||
yield PyPIRepository([], cache_dir=cache_dir) | ||
|
||
|
||
def test_parse_requirements_preserve_editable_relative(repository): | ||
test_package_path = os.path.join(PACKAGES_RELATIVE_PATH, "small_fake_a") | ||
|
||
with tempfile.NamedTemporaryFile("w") as infile: | ||
infile.write(f"-e {test_package_path}") | ||
infile.flush() | ||
[install_requirement] = parse_requirements( | ||
infile.name, session=repository.session | ||
) | ||
|
||
assert install_requirement.link.url == test_package_path | ||
assert install_requirement.link.file_path == test_package_path |