File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 1+ Normalize the package names to lowercase when comparing used and in-Pipfile packages.
Original file line number Diff line number Diff line change @@ -242,7 +242,9 @@ def import_from_code(path="."):
242242
243243 rs = []
244244 try :
245- for r in pipreqs .get_all_imports (path ):
245+ for r in pipreqs .get_all_imports (
246+ path , encoding = "utf-8" , extra_ignore_dirs = [".venv" ]
247+ ):
246248 if r not in BAD_PACKAGES :
247249 rs .append (r )
248250 pkg_names = pipreqs .get_pkg_names (rs )
@@ -2537,8 +2539,8 @@ def do_check(
25372539 if not args :
25382540 args = []
25392541 if unused :
2540- deps_required = [k for k in project .packages .keys ()]
2541- deps_needed = import_from_code (unused )
2542+ deps_required = [k . lower () for k in project .packages .keys ()]
2543+ deps_needed = [ k . lower () for k in import_from_code (unused )]
25422544 for dep in deps_needed :
25432545 try :
25442546 deps_required .remove (dep )
Original file line number Diff line number Diff line change @@ -217,20 +217,20 @@ def test_install_parse_error(PipenvInstance, pypi):
217217@pytest .mark .code
218218@pytest .mark .check
219219@pytest .mark .unused
220- @pytest .mark .skip (reason = "non-deterministic" )
220+ @pytest .mark .needs_internet (reason = 'required by check' )
221221def test_check_unused (PipenvInstance , pypi ):
222222 with PipenvInstance (chdir = True , pypi = pypi ) as p :
223223 with open ('__init__.py' , 'w' ) as f :
224224 contents = """
225225import tablib
226226import records
227+ import flask
227228 """ .strip ()
228229 f .write (contents )
229- p .pipenv ('install requests' )
230- p .pipenv ('install tablib' )
231- p .pipenv ('install records' )
230+ p .pipenv ('install requests tablib flask' )
232231
233- assert all (pkg in p .pipfile ['packages' ] for pkg in ['requests' , 'tablib' , 'records ' ])
232+ assert all (pkg in p .pipfile ['packages' ] for pkg in ['requests' , 'tablib' , 'flask ' ])
234233
235234 c = p .pipenv ('check --unused .' )
236235 assert 'tablib' not in c .out
236+ assert 'flask' not in c .out
You can’t perform that action at this time.
0 commit comments