Skip to content

Commit

Permalink
Merge pull request #2262 from pypa/nelfin-fix-2229
Browse files Browse the repository at this point in the history
Nelfin fix 2229
  • Loading branch information
uranusjr authored Jun 1, 2018
2 parents e135f7c + 5788db3 commit f91f53b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2564,14 +2564,13 @@ def do_clean(
# Ensure that virtualenv is available.
ensure_project(three=three, python=python, validate=False)
ensure_lockfile()
installed_packages = filter(
None,
delegator.run('{0} freeze'.format(which_pip())).out.strip().split(
'\n'
),
)

installed_package_names = []
for installed in installed_packages:
pip_freeze_command = delegator.run('{0} freeze'.format(which_pip()))
for line in pip_freeze_command.out.split('\n'):
installed = line.strip()
if not installed or installed.startswith('#'): # Comment or empty.
continue
r = Requirement.from_line(installed).requirement
# Ignore editable installations.
if not r.editable:
Expand Down
20 changes: 20 additions & 0 deletions tests/integration/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ def test_pipenv_check(PipenvInstance, pypi):
assert 'requests' in p.pipenv('check').out


@pytest.mark.cli
def test_pipenv_clean_pip_no_warnings(PipenvInstance):
with PipenvInstance(chdir=True) as p:
with open('setup.py', 'w') as f:
f.write('from setuptools import setup; setup(name="empty")')
p.pipenv('run pip install -e .')
assert p.pipenv('clean').out


@pytest.mark.cli
def test_pipenv_clean_pip_warnings(PipenvInstance):
with PipenvInstance(chdir=True) as p:
with open('setup.py', 'w') as f:
f.write('from setuptools import setup; setup(name="empty")')
# create a fake git repo to trigger a pip freeze warning
os.mkdir('.git')
p.pipenv('run pip install -e .')
assert p.pipenv('clean').out


@pytest.mark.cli
def test_venv_envs(PipenvInstance):
with PipenvInstance() as p:
Expand Down

0 comments on commit f91f53b

Please sign in to comment.