Skip to content

Commit

Permalink
Merge pull request #4322 from pypa/bugfix/uninstall-missing-param
Browse files Browse the repository at this point in the history
Correct the exception to PipenvUsageError
  • Loading branch information
frostming authored Jun 6, 2020
2 parents 97324a6 + 4f7bb36 commit 49f1cb0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions news/4321.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug that ``pipenv uninstall`` throws an exception that does not exist.
5 changes: 1 addition & 4 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2231,10 +2231,7 @@ def do_uninstall(
ensure_project(three=three, python=python, pypi_mirror=pypi_mirror)
# Un-install all dependencies, if --all was provided.
if not any([packages, editable_packages, all_dev, all]):
raise exceptions.MissingParameter(
crayons.red("No package provided!"),
ctx=ctx, param_type="parameter",
)
raise exceptions.PipenvUsageError("No package provided!", ctx=ctx)
editable_pkgs = [
Requirement.from_line("-e {0}".format(p)).name for p in editable_packages if p
]
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/test_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,14 @@ def test_uninstall_all_dev_with_shared_dependencies(PipenvInstance):
assert c.return_code == 0

assert "six" in p.lockfile["develop"]


@pytest.mark.uninstall
def test_uninstall_missing_parameters(PipenvInstance):
with PipenvInstance() as p:
c = p.pipenv("install requests")
assert c.return_code == 0

c = p.pipenv("uninstall")
assert c.return_code != 0
assert "No package provided!" in c.err

0 comments on commit 49f1cb0

Please sign in to comment.