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

Nelfin fix 2229 #2262

Merged
merged 2 commits into from
Jun 1, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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