Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove inconsistent test and fix filename write
  • Loading branch information
hellozee committed Sep 3, 2024
commit ed63b3d5b435d2e8741c3316bb9807cd0a8717f5
16 changes: 5 additions & 11 deletions tests/unit/test_req_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,10 @@ def test_recursive_requirements_file(
list(parse_requirements(filename=str(req_files[0]), session=session))

# When one of other the requirements file recursively references itself
req_files[req_file_count - 1].write_text(f"-r {req_files[req_file_count - 2]}")
req_files[req_file_count - 1].write_text(
# Just name since they are in the same folder
f"-r {req_files[req_file_count - 2].name}"
)
with pytest.raises(
RecursionError,
match=(
Expand All @@ -386,7 +389,7 @@ def test_recursive_requirements_file(
list(parse_requirements(filename=str(req_files[0]), session=session))

def test_recursive_relative_requirements_file(
self, monkeypatch: pytest.MonkeyPatch, tmpdir: Path, session: PipSession
self, tmpdir: Path, session: PipSession
) -> None:
root_req_file = tmpdir / "root.txt"
(tmpdir / "nest" / "nest").mkdir(parents=True)
Expand All @@ -406,15 +409,6 @@ def test_recursive_relative_requirements_file(
):
list(parse_requirements(filename=str(root_req_file), session=session))

# If we don't use absolute path, it keeps on chaining the filename resulting in
# a huge filename, since a != a/b/c/../../
monkeypatch.setattr(os.path, "abspath", lambda x: x)
with pytest.raises(
pip._internal.exceptions.InstallationError,
match="Could not open requirements file: .* File name too long:",
):
list(parse_requirements(filename=str(root_req_file), session=session))

def test_options_on_a_requirement_line(self, line_processor: LineProcessor) -> None:
line = (
'SomeProject --global-option="yo3" --global-option "yo4" '
Expand Down