mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
+6
-11
@@ -44,9 +44,9 @@ from . import pep508checker, progress
|
||||
from . import environments
|
||||
from .environments import (
|
||||
PIPENV_COLORBLIND, PIPENV_NOSPIN, PIPENV_SHELL_FANCY,
|
||||
PIPENV_VENV_IN_PROJECT, PIPENV_USE_SYSTEM, PIPENV_TIMEOUT,
|
||||
PIPENV_SKIP_VALIDATION, PIPENV_HIDE_EMOJIS, PIPENV_INSTALL_TIMEOUT,
|
||||
PYENV_ROOT, PYENV_INSTALLED, PIPENV_YES, PIPENV_DONT_LOAD_ENV,
|
||||
PIPENV_VENV_IN_PROJECT, PIPENV_TIMEOUT, PIPENV_SKIP_VALIDATION,
|
||||
PIPENV_HIDE_EMOJIS, PIPENV_INSTALL_TIMEOUT, PYENV_ROOT,
|
||||
PYENV_INSTALLED, PIPENV_YES, PIPENV_DONT_LOAD_ENV,
|
||||
PIPENV_DEFAULT_PYTHON_VERSION, PIPENV_MAX_SUBPROCESS,
|
||||
PIPENV_DONT_USE_PYENV, SESSION_IS_INTERACTIVE, PIPENV_USE_SYSTEM,
|
||||
PIPENV_DOTENV_LOCATION, PIPENV_SHELL
|
||||
@@ -409,7 +409,6 @@ def ensure_python(three=None, python=None):
|
||||
), err=True
|
||||
)
|
||||
|
||||
|
||||
global USING_DEFAULT_PYTHON
|
||||
|
||||
# Add pyenv paths to PATH.
|
||||
@@ -759,7 +758,6 @@ def do_install_dependencies(
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
# Allow pip to resolve dependencies when in skip-lock mode.
|
||||
no_deps = (not skip_lock)
|
||||
|
||||
@@ -1128,7 +1126,6 @@ def do_lock(verbose=False, system=False, clear=False, pre=False):
|
||||
click.echo('Please run $ {0} to re-create your environment.'.crayons.red('pipenv --rm'))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# Write out the lockfile.
|
||||
with open(project.lockfile_location, 'w') as f:
|
||||
simplejson.dump(lockfile, f, indent=4, separators=(',', ': '), sort_keys=True)
|
||||
@@ -1545,6 +1542,7 @@ def warn_in_virtualenv():
|
||||
), err=True
|
||||
)
|
||||
|
||||
|
||||
def kr_easter_egg(package_name):
|
||||
if package_name in ['requests', 'maya', 'crayons', 'delegator.py', 'records', 'tablib', 'background', 'clint']:
|
||||
|
||||
@@ -1968,7 +1966,6 @@ def lock(three=None, python=False, verbose=False, requirements=False, clear=Fals
|
||||
if not pre:
|
||||
pre = project.settings.get('pre')
|
||||
|
||||
|
||||
if requirements:
|
||||
do_init(dev=True, requirements=requirements)
|
||||
|
||||
@@ -2270,7 +2267,6 @@ def check(three=None, python=False, unused=False, style=False, args=None):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
||||
@click.command(help=u"Displays currently–installed dependency graph information.")
|
||||
@click.option('--bare', is_flag=True, default=False, help="Minimal output.")
|
||||
@click.option('--json', is_flag=True, default=False, help="Output JSON.")
|
||||
@@ -2329,6 +2325,7 @@ def graph(bare=False, json=False):
|
||||
# Return its return code.
|
||||
sys.exit(c.return_code)
|
||||
|
||||
|
||||
@click.command(help="View a given module in your editor.", name="open")
|
||||
@click.option('--three/--two', is_flag=True, default=None, help="Use Python 3/2 when creating virtualenv.")
|
||||
@click.option('--python', default=False, nargs=1, help="Specify which version of Python virtualenv should use.")
|
||||
@@ -2356,7 +2353,6 @@ def run_open(module, three=None, python=None):
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
@click.command(help="Uninstalls all packages, and re-installs package(s) in [packages] to latest compatible versions.")
|
||||
@click.argument('package_name', default=False)
|
||||
@click.option('--verbose', '-v', is_flag=True, default=False, help="Verbose mode.")
|
||||
@@ -2372,7 +2368,7 @@ def update(ctx, dev=False, three=None, python=None, dry_run=False, bare=False, d
|
||||
|
||||
# Ensure that virtualenv is available.
|
||||
ensure_project(three=three, python=python, validate=False)
|
||||
|
||||
|
||||
concurrent = (not sequential)
|
||||
|
||||
# --dry-run:
|
||||
@@ -2479,7 +2475,6 @@ def update(ctx, dev=False, three=None, python=None, dry_run=False, bare=False, d
|
||||
)
|
||||
|
||||
|
||||
|
||||
# Install click commands.
|
||||
cli.add_command(graph)
|
||||
cli.add_command(install)
|
||||
|
||||
@@ -24,6 +24,7 @@ if PIPENV_PIPFILE:
|
||||
else:
|
||||
PIPENV_PIPFILE = os.path.abspath(PIPENV_PIPFILE)
|
||||
|
||||
|
||||
class Project(object):
|
||||
"""docstring for Project"""
|
||||
|
||||
|
||||
@@ -2,14 +2,9 @@ import os
|
||||
|
||||
from mock import patch, Mock, PropertyMock
|
||||
|
||||
import pytest
|
||||
from pipenv.vendor import toml
|
||||
from pipenv.vendor import delegator
|
||||
|
||||
from pipenv.cli import (
|
||||
activate_virtualenv, ensure_proper_casing, pip_install, pip_download
|
||||
pip_install, pip_download
|
||||
)
|
||||
from pipenv.project import Project
|
||||
|
||||
# Tell pipenv to ignore activated virtualenvs.
|
||||
os.environ['PIPENV_IGNORE_VIRTUALENVS'] = 'True'
|
||||
|
||||
@@ -12,6 +12,7 @@ from pipenv.project import Project
|
||||
|
||||
os.environ['PIPENV_DONT_USE_PYENV'] = '1'
|
||||
|
||||
|
||||
class PipenvInstance():
|
||||
"""An instance of a Pipenv Project..."""
|
||||
def __init__(self, pipfile=True, chdir=False):
|
||||
@@ -325,7 +326,7 @@ tpfd = "*"
|
||||
|
||||
c = p.pipenv('run python -c "import requests; import idna; import certifi; import records; import tpfd; import parse;"')
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
@pytest.mark.sequential
|
||||
@pytest.mark.install
|
||||
@pytest.mark.update
|
||||
@@ -348,13 +349,13 @@ records = "*"
|
||||
assert 'urllib3' in p.lockfile['default']
|
||||
assert 'certifi' in p.lockfile['default']
|
||||
assert 'records' in p.lockfile['default']
|
||||
|
||||
|
||||
c = p.pipenv('run python -c "import requests; import idna; import certifi; import records;"')
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
c = p.pipenv('update --sequential')
|
||||
assert c.return_code == 0
|
||||
|
||||
assert c.return_code == 0
|
||||
|
||||
assert 'requests' in p.lockfile['default']
|
||||
assert 'idna' in p.lockfile['default']
|
||||
assert 'urllib3' in p.lockfile['default']
|
||||
@@ -362,7 +363,7 @@ records = "*"
|
||||
assert 'records' in p.lockfile['default']
|
||||
|
||||
c = p.pipenv('run python -c "import requests; import idna; import certifi; import records;"')
|
||||
assert c.return_code == 0
|
||||
assert c.return_code == 0
|
||||
|
||||
@pytest.mark.run
|
||||
@pytest.mark.markers
|
||||
@@ -480,7 +481,6 @@ requests = {version = "*"}
|
||||
assert 'path' in p.pipfile['dev-packages'][key]
|
||||
assert 'requests' in p.lockfile['develop']
|
||||
|
||||
|
||||
@pytest.mark.code
|
||||
@pytest.mark.install
|
||||
def test_code_import_manual(self):
|
||||
@@ -582,7 +582,6 @@ pytest = "==3.1.1"
|
||||
for req in req_list:
|
||||
assert req in c.out
|
||||
|
||||
|
||||
@pytest.mark.lock
|
||||
@pytest.mark.requirements
|
||||
@pytest.mark.complex
|
||||
|
||||
@@ -3,7 +3,7 @@ from pipenv.vendor import delegator
|
||||
|
||||
|
||||
class TestProject():
|
||||
|
||||
|
||||
def test_proper_names(self):
|
||||
proj = pipenv.project.Project()
|
||||
assert proj.virtualenv_location in proj.proper_names_location
|
||||
|
||||
Reference in New Issue
Block a user