Skip to content

Commit

Permalink
Remove inconsistent test and fix filename write
Browse files Browse the repository at this point in the history
  • Loading branch information
hellozee committed Jul 27, 2024
1 parent cbb3290 commit 8fc7ef0
Showing 1 changed file with 5 additions and 11 deletions.
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

0 comments on commit 8fc7ef0

Please sign in to comment.