Skip to content

Commit

Permalink
Fix pipenv --clear is not working (#3354)
Browse files Browse the repository at this point in the history
Fix pipenv --clear is not working

Co-authored-by: Dan Ryan <dan@danryan.co>
  • Loading branch information
techalchemy authored Jun 6, 2019
2 parents c0f1f75 + d532691 commit 46a28a4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
1 change: 1 addition & 0 deletions news/3353.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug where pipenv --clear is not working
16 changes: 6 additions & 10 deletions pipenv/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,15 @@ def cli(
state,
where=False,
venv=False,
rm=False,
bare=False,
three=False,
python=False,
help=False,
py=False,
envs=False,
man=False,
rm=False,
bare=False,
completion=False,
pypi_mirror=None,
man=False,
support=None,
clear=False,
help=False,
site_packages=False,
**kwargs
):
# Handle this ASAP to make shell startup fast.
Expand Down Expand Up @@ -143,10 +140,9 @@ def cli(
get_pipenv_diagnostics()
return 0
# --clear was passed…
elif clear:
elif state.clear:
do_clear()
return 0

# --venv was passed…
elif venv:
# There is no virtualenv yet.
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,19 @@ def test_check_unused(PipenvInstance, pypi):
c = p.pipenv('check --unused .')
assert 'tablib' not in c.out
assert 'flask' not in c.out


@pytest.mark.cli
def test_pipenv_clear(PipenvInstance):
with PipenvInstance() as p:
c = p.pipenv('--clear')
assert c.return_code == 0
assert 'Clearing caches' in c.out


@pytest.mark.cli
def test_pipenv_three(PipenvInstance):
with PipenvInstance() as p:
c = p.pipenv('--three')
assert c.return_code == 0
assert 'Successfully created virtual environment' in c.err

0 comments on commit 46a28a4

Please sign in to comment.