diff --git a/pipenv/core.py b/pipenv/core.py index 3e307c40..7b4d2392 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -2523,12 +2523,12 @@ def do_clean( # Ensure that virtualenv is available. ensure_project(three=three, python=python, validate=False) ensure_lockfile() - installed_packages = delegator.run( + installed_packages = filter(None, delegator.run( '{0} freeze'.format(which('pip')) ).out.strip( ).split( '\n' - ) + )) installed_package_names = [] for installed in installed_packages: r = get_requirement(installed) diff --git a/tests/test_pipenv.py b/tests/test_pipenv.py index 5cb012c1..110bd68e 100644 --- a/tests/test_pipenv.py +++ b/tests/test_pipenv.py @@ -1051,3 +1051,9 @@ requests = "==2.14.0" assert target_package in p.pipfile['packages'] assert p.pipfile['packages'][target_package] == '*' assert target_package in p.lockfile['default'] + + @pytest.mark.clean + def test_clean_on_empty_venv(self, pypi): + with PipenvInstance(pypi=pypi) as p: + c = p.pipenv('clean') + assert c.return_code == 0