Skip to content

Commit

Permalink
Use more local tests
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Ryan <[email protected]>
  • Loading branch information
techalchemy committed Jul 1, 2018
1 parent 7050b4c commit a245be1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include README.rst LICENSE NOTICES HISTORY.txt pipenv/patched/safety.zip
include README.rst CHANGELOG.rst LICENSE NOTICES HISTORY.txt pipenv/patched/safety.zip
include pipenv/vendor/pipreqs/stdlib
include pipenv/vendor/pipreqs/mapping
include pipenv/vendor/click_completion/*.j2
Expand Down
2 changes: 1 addition & 1 deletion pipenv/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def cli(
loc = project.virtualenv_location
echo(
crayons.normal(
u'{0} ({1})'.format(
u'{0} ({1})...'.format(
crayons.normal('Removing virtualenv', bold=True),
crayons.green(loc),
)
Expand Down
39 changes: 22 additions & 17 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,8 @@
PIPENV_MAX_SUBPROCESS,
PIPENV_DONT_USE_PYENV,
SESSION_IS_INTERACTIVE,
PIPENV_USE_SYSTEM,
PIPENV_DOTENV_LOCATION,
PIPENV_PYTHON,
PIPENV_CACHE_DIR,
PIPENV_VIRTUALENV,
)

# Packages that should be ignored later.
Expand Down Expand Up @@ -242,6 +239,7 @@ def import_from_code(path='.'):

def ensure_pipfile(validate=True, skip_requirements=False, system=False):
"""Creates a Pipfile for the project, if it doesn't exist."""
from .environments import PIPENV_VIRTUALENV
# Assert Pipfile exists.
python = which('python') if not (USING_DEFAULT_PYTHON or system) else None
if project.pipfile_is_empty:
Expand Down Expand Up @@ -376,6 +374,7 @@ def find_a_system_python(python):

def ensure_python(three=None, python=None):
# Support for the PIPENV_PYTHON environment variable.
from .environments import PIPENV_PYTHON
if PIPENV_PYTHON and python is False and three is None:
python = PIPENV_PYTHON

Expand Down Expand Up @@ -532,6 +531,7 @@ def activate_pyenv():

def ensure_virtualenv(three=None, python=None, site_packages=False, pypi_mirror=None):
"""Creates a virtualenv, if one doesn't exist."""
from .environments import PIPENV_USE_SYSTEM

def abort():
sys.exit(1)
Expand Down Expand Up @@ -597,6 +597,7 @@ def ensure_project(
pypi_mirror=None,
):
"""Ensures both Pipfile and virtualenv exist for the project."""
from .environments import PIPENV_USE_SYSTEM
# Automatically use an activated virtualenv.
if PIPENV_USE_SYSTEM:
system = True
Expand Down Expand Up @@ -1222,6 +1223,7 @@ def do_init(
pypi_mirror=None,
):
"""Executes the init functionality."""
from .environments import PIPENV_VIRTUALENV
cleanup_reqdir = False
if not system:
if not project.virtualenv_exists:
Expand Down Expand Up @@ -1626,20 +1628,21 @@ def gen(out):


def warn_in_virtualenv():
if PIPENV_USE_SYSTEM:
# Only warn if pipenv isn't already active.
if 'PIPENV_ACTIVE' not in os.environ:
click.echo(
'{0}: Pipenv found itself running within a virtual environment, '
'so it will automatically use that environment, instead of '
'creating its own for any project. You can set '
'{1} to force pipenv to ignore that environment and create '
'its own instead.'.format(
crayons.green('Courtesy Notice'),
crayons.normal('PIPENV_IGNORE_VIRTUALENVS=1', bold=True),
),
err=True,
)
from .environments import PIPENV_USE_SYSTEM, PIPENV_VIRTUALENV
# Only warn if pipenv isn't already active.
pipenv_active = os.environ.get('PIPENV_ACTIVE')
if (PIPENV_USE_SYSTEM or PIPENV_VIRTUALENV) and not pipenv_active:
click.echo(
'{0}: Pipenv found itself running within a virtual environment, '
'so it will automatically use that environment, instead of '
'creating its own for any project. You can set '
'{1} to force pipenv to ignore that environment and create '
'its own instead.'.format(
crayons.green('Courtesy Notice'),
crayons.normal('PIPENV_IGNORE_VIRTUALENVS=1', bold=True),
),
err=True,
)


def ensure_lockfile(keep_outdated=False, pypi_mirror=None):
Expand Down Expand Up @@ -1730,6 +1733,7 @@ def do_install(
keep_outdated=False,
selective_upgrade=False,
):
from .environments import PIPENV_VIRTUALENV, PIPENV_USE_SYSTEM
from notpip._internal.exceptions import PipError

requirements_directory = TemporaryDirectory(
Expand Down Expand Up @@ -2058,6 +2062,7 @@ def do_uninstall(
keep_outdated=False,
pypi_mirror=None,
):
from .environments import PIPENV_USE_SYSTEM
# Automatically use an activated virtualenv.
if PIPENV_USE_SYSTEM:
system = True
Expand Down

0 comments on commit a245be1

Please sign in to comment.