Skip to content

Commit

Permalink
Hotfix: resolving nested dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
yeisonvargasf committed Sep 19, 2022
1 parent d2976e1 commit 7c152a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dparse/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def resolve_file(cls, file_path, line):
normalized_path = PurePath(file_path)
if " #" in line:
line = line.split("#")[0].strip()
return str(normalized_path.joinpath(line))
return str(normalized_path.parent.joinpath(line))


class RequirementsTXTParser(Parser):
Expand Down
6 changes: 6 additions & 0 deletions tests/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import unicode_literals

import sys
from pathlib import PurePath

from dparse.errors import MalformedDependencyFileError

Expand Down Expand Up @@ -93,6 +94,11 @@ def test_resolve_file():
line = "-r req.txt"
assert Parser.resolve_file("", line) == "req.txt"

line = "-r req_2.txt"
path = PurePath("safety", "tests", "foo.txt")
assert Parser.resolve_file(str(path), line) == str(
PurePath("safety", "tests", "req_2.txt"))


def test_index_server():
line = "--index-url https://some.foo/"
Expand Down

0 comments on commit 7c152a9

Please sign in to comment.