mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 06:46:15 +00:00
Update all vendored dependencies
- Clean up test config and environment variable handling - Unset env var changes performend by `pipenv run` - Make `environments.is_in_virtualenv()` more dynamic -- read environment on the fly - Split up tests on `pipenv run` to reduce complexity -- one test for global run (no virtualenv creation), one test for virtualenv creation - Add `warn_in_virtualenv` call to `run` command, why doesn't click invoke this automatically? Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
@@ -8,6 +8,7 @@ import pytest
|
||||
from pipenv.patched import pipfile
|
||||
from pipenv.project import Project
|
||||
from pipenv.utils import temp_environ
|
||||
import pipenv.environments
|
||||
|
||||
|
||||
@pytest.mark.project
|
||||
@@ -168,25 +169,41 @@ def test_include_editable_packages(PipenvInstance, pypi, testsroot, pathlib_tmpd
|
||||
|
||||
@pytest.mark.project
|
||||
@pytest.mark.virtualenv
|
||||
def test_run_in_virtualenv(PipenvInstance, pypi, virtualenv):
|
||||
with PipenvInstance(chdir=True, pypi=pypi) as p:
|
||||
os.environ['PIPENV_IGNORE_VIRTUALENVS'] = '1'
|
||||
def test_run_in_virtualenv_with_global_context(PipenvInstance, pypi, virtualenv):
|
||||
with PipenvInstance(chdir=True, pypi=pypi, venv_root=virtualenv.as_posix(), ignore_virtualenvs=False, venv_in_project=False) as p:
|
||||
c = p.pipenv('run which pip')
|
||||
assert c.return_code == 0
|
||||
assert 'virtualenv' not in c.out
|
||||
|
||||
os.environ.pop("PIPENV_IGNORE_VIRTUALENVS", None)
|
||||
c = p.pipenv('run which pip')
|
||||
assert c.return_code == 0
|
||||
assert 'virtualenv' in c.out
|
||||
assert 'Creating a virtualenv' not in c.err
|
||||
project = Project()
|
||||
assert project.virtualenv_location == str(virtualenv)
|
||||
c = p.pipenv("run pip install click")
|
||||
assert c.return_code == 0
|
||||
assert "Courtesy Notice" in c.err
|
||||
c = p.pipenv("install six")
|
||||
assert c.return_code == 0
|
||||
c = p.pipenv('run python -c "import click;print(click.__file__)"')
|
||||
assert c.return_code == 0
|
||||
assert c.out.strip().startswith(str(virtualenv))
|
||||
c = p.pipenv("clean --dry-run")
|
||||
assert c.return_code == 0
|
||||
assert "click" in c.out
|
||||
|
||||
|
||||
@pytest.mark.project
|
||||
@pytest.mark.virtualenv
|
||||
def test_run_in_virtualenv(PipenvInstance, pypi):
|
||||
with PipenvInstance(chdir=True, pypi=pypi) as p:
|
||||
c = p.pipenv('run which pip')
|
||||
assert c.return_code == 0
|
||||
assert 'Creating a virtualenv' in c.err
|
||||
project = Project()
|
||||
c = p.pipenv("run pip install click")
|
||||
assert c.return_code == 0
|
||||
c = p.pipenv("install six")
|
||||
assert c.return_code == 0
|
||||
c = p.pipenv('run python -c "import click;print(click.__file__)"')
|
||||
assert c.return_code == 0
|
||||
assert c.out.strip().startswith(str(project.virtualenv_location))
|
||||
c = p.pipenv("clean --dry-run")
|
||||
assert c.return_code == 0
|
||||
assert "click" in c.out
|
||||
|
||||
Reference in New Issue
Block a user