Correct the exception to PipenvUsageError

This commit is contained in:
Frost Ming
2020-06-06 10:59:29 +08:00
parent 97324a6932
commit 4f7bb36f92
3 changed files with 13 additions and 4 deletions
+1
View File
@@ -0,0 +1 @@
Fix a bug that ``pipenv uninstall`` throws an exception that does not exist.
+1 -4
View File
@@ -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
]
+11
View File
@@ -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