mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Merge pull request #990 from kennethreitz/issue-873
updated --dev flag to --all-dev for uninstall
This commit is contained in:
+5
-2
@@ -139,7 +139,7 @@ Create a Pipfile.lock from the installed versions:
|
||||
Install from that Pipfile.lock:
|
||||
|
||||
$ pipenv install --ignore-pipfile
|
||||
|
||||
|
||||
|
||||
.. _initialization:
|
||||
|
||||
@@ -270,11 +270,14 @@ $ pipenv uninstall
|
||||
//////////////////
|
||||
|
||||
``$ pipenv uninstall`` supports all of the parameters in `pipenv install <#pipenv-install>`_,
|
||||
as well as one additonal, ``--all``.
|
||||
as well as two additonal options, ``--all`` and ``--all-dev``.
|
||||
|
||||
- ``--all`` — This parameter will purge all files from the virtual environment,
|
||||
but leave the Pipfile untouched.
|
||||
|
||||
- ``--all-dev`` — This parameter will remove all of the development packages from
|
||||
the virtual environment, and remove them from the Pipfile.
|
||||
|
||||
|
||||
.. _pipenv_lock:
|
||||
|
||||
|
||||
+4
-4
@@ -1927,11 +1927,11 @@ def install(
|
||||
@click.option('--system', is_flag=True, default=False, help="System pip management.")
|
||||
@click.option('--verbose', is_flag=True, default=False, help="Verbose mode.")
|
||||
@click.option('--lock', is_flag=True, default=True, help="Lock afterwards.")
|
||||
@click.option('--dev', '-d', is_flag=True, default=False, help="Un-install all package from [dev-packages].")
|
||||
@click.option('--all-dev', is_flag=True, default=False, help="Un-install all package from [dev-packages].")
|
||||
@click.option('--all', is_flag=True, default=False, help="Purge all package(s) from virtualenv. Does not edit Pipfile.")
|
||||
def uninstall(
|
||||
package_name=False, more_packages=False, three=None, python=False,
|
||||
system=False, lock=False, dev=False, all=False, verbose=False
|
||||
system=False, lock=False, all_dev=False, all=False, verbose=False
|
||||
):
|
||||
|
||||
# Automatically use an activated virtualenv.
|
||||
@@ -1956,7 +1956,7 @@ def uninstall(
|
||||
sys.exit(0)
|
||||
|
||||
# Uninstall [dev-packages], if --dev was provided.
|
||||
if dev:
|
||||
if all_dev:
|
||||
if 'dev-packages' not in project.parsed_pipfile:
|
||||
click.echo(
|
||||
crayons.normal('No {0} to uninstall.'.format(
|
||||
@@ -1973,7 +1973,7 @@ def uninstall(
|
||||
package_names = project.parsed_pipfile['dev-packages']
|
||||
package_names = package_names.keys()
|
||||
|
||||
if package_name is False and not dev:
|
||||
if package_name is False and not all_dev:
|
||||
click.echo(crayons.red('No package provided!'), err=True)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@@ -271,6 +271,28 @@ class TestPipenv:
|
||||
assert 'tablib' in c.out
|
||||
assert 'tablib' not in p.pipfile['packages']
|
||||
|
||||
@pytest.mark.run
|
||||
@pytest.mark.uninstall
|
||||
def test_uninstall_all_dev(self):
|
||||
with PipenvInstance() as p:
|
||||
c = p.pipenv('install --dev requests pytest')
|
||||
assert c.return_code == 0
|
||||
assert 'requests' in p.pipfile['dev-packages']
|
||||
assert 'pytest' in p.pipfile['dev-packages']
|
||||
assert 'requests' in p.lockfile['develop']
|
||||
assert 'pytest' in p.lockfile['develop']
|
||||
|
||||
|
||||
c = p.pipenv('uninstall --all-dev')
|
||||
assert c.return_code == 0
|
||||
assert 'requests' not in p.pipfile['dev-packages']
|
||||
assert 'pytest' not in p.pipfile['dev-packages']
|
||||
assert 'requests' not in p.lockfile['develop']
|
||||
assert 'pytest' not in p.lockfile['develop']
|
||||
|
||||
c = p.pipenv('run python -m requests.help')
|
||||
assert c.return_code > 0
|
||||
|
||||
@pytest.mark.extras
|
||||
@pytest.mark.install
|
||||
def test_extras_install(self):
|
||||
|
||||
Reference in New Issue
Block a user