Skip to content

Commit

Permalink
Merge pull request #431 from pyupio/fix/recursive-deps-parsing
Browse files Browse the repository at this point in the history
Returning deps after one unpinned dependency.
  • Loading branch information
yeisonvargasf committed Nov 27, 2022
2 parents eadcbe1 + 77b46da commit 7869401
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion safety/util.py
Expand Up @@ -70,7 +70,7 @@ def read_requirements(fh, resolve=True):
fg="yellow",
file=sys.stderr
)
return
continue

version = spec[1]
if spec[0] == '==':
Expand Down
1 change: 1 addition & 0 deletions tests/reqs_pinned.txt
@@ -0,0 +1 @@
django==4.1.3
4 changes: 4 additions & 0 deletions tests/reqs_pinned_and_unpinned.txt
@@ -0,0 +1,4 @@
-r reqs_pinned.txt
packaging==21.3
pipenv
flower==1.2.0
8 changes: 8 additions & 0 deletions tests/test_util.py
Expand Up @@ -35,6 +35,14 @@ def test_recursive_requirement(self):
result = list(read_requirements(fh, resolve=True))
self.assertEqual(len(result), 2)

def test_recursive_requirement_pinned_after_unpinned(self):
# this should find 3 packages, unpinned are ignored
dirname = os.path.dirname(__file__)
test_filename = os.path.join(dirname, "reqs_pinned_and_unpinned.txt")
with open(test_filename) as fh:
result = list(read_requirements(fh, resolve=True))
self.assertEqual(len(result), 3)

@patch("safety.util.get_flags_from_context")
@patch.object(sys, 'argv', ['safety/__main__.py', 'check', '--key=my-key', '-i', '3232', '-i', '3231', '--ignore',
'1212', '--json'])
Expand Down

0 comments on commit 7869401

Please sign in to comment.