Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning deps after one unpinned dependency. #431

Merged
merged 1 commit into from Nov 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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