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="."):
242
242
243
243
rs = []
244
244
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
+ ):
246
248
if r not in BAD_PACKAGES :
247
249
rs .append (r )
248
250
pkg_names = pipreqs .get_pkg_names (rs )
@@ -2537,8 +2539,8 @@ def do_check(
2537
2539
if not args :
2538
2540
args = []
2539
2541
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 )]
2542
2544
for dep in deps_needed :
2543
2545
try :
2544
2546
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):
217
217
@pytest .mark .code
218
218
@pytest .mark .check
219
219
@pytest .mark .unused
220
- @pytest .mark .skip (reason = "non-deterministic" )
220
+ @pytest .mark .needs_internet (reason = 'required by check' )
221
221
def test_check_unused (PipenvInstance , pypi ):
222
222
with PipenvInstance (chdir = True , pypi = pypi ) as p :
223
223
with open ('__init__.py' , 'w' ) as f :
224
224
contents = """
225
225
import tablib
226
226
import records
227
+ import flask
227
228
""" .strip ()
228
229
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' )
232
231
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 ' ])
234
233
235
234
c = p .pipenv ('check --unused .' )
236
235
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