mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
fix installation of non-editable requirements
- Fix tests to ensure commands return prior to follow ups Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
+4
-2
@@ -1389,11 +1389,14 @@ def pip_install(
|
||||
install_reqs = [editable_opt, req] + install_reqs
|
||||
if not any(item.startswith("--hash") for item in install_reqs):
|
||||
ignore_hashes = True
|
||||
else:
|
||||
elif r:
|
||||
install_reqs = ["-r", r]
|
||||
with open(r) as f:
|
||||
if "--hash" not in f.read():
|
||||
ignore_hashes = True
|
||||
else:
|
||||
ignore_hashes = True if not requirement.hashes else False
|
||||
install_reqs = requirement.as_line(as_list=True)
|
||||
pip_command = [which_pip(allow_global=allow_global), "install"]
|
||||
if pre:
|
||||
pip_command.append("--pre")
|
||||
@@ -1409,7 +1412,6 @@ def pip_install(
|
||||
install_reqs = [escape_cmd(req) for req in install_reqs]
|
||||
pip_command.extend(install_reqs)
|
||||
pip_command.extend(prepare_pip_source_args(sources))
|
||||
print(pip_command)
|
||||
if not ignore_hashes:
|
||||
pip_command.append("--require-hashes")
|
||||
|
||||
|
||||
@@ -121,6 +121,7 @@ class _PipenvInstance(object):
|
||||
def pipenv(self, cmd, block=True):
|
||||
if self.pipfile_path:
|
||||
os.environ['PIPENV_PIPFILE'] = self.pipfile_path
|
||||
# a bit of a hack to make sure the virtualenv is created
|
||||
|
||||
with TemporaryDirectory(prefix='pipenv-', suffix='-cache') as tempdir:
|
||||
os.environ['PIPENV_CACHE_DIR'] = tempdir.name
|
||||
@@ -136,6 +137,8 @@ class _PipenvInstance(object):
|
||||
print('$ pipenv {0}'.format(cmd))
|
||||
print(c.out)
|
||||
print(c.err)
|
||||
if c.return_code != 0:
|
||||
print("Command failed...")
|
||||
|
||||
# Where the action happens.
|
||||
return c
|
||||
|
||||
@@ -12,56 +12,84 @@ from pipenv.utils import normalize_drive
|
||||
@pytest.mark.cli
|
||||
def test_pipenv_where(PipenvInstance, pypi_secure):
|
||||
with PipenvInstance(pypi=pypi_secure) as p:
|
||||
assert normalize_drive(p.path) in p.pipenv('--where').out
|
||||
c = p.pipenv("--where")
|
||||
assert c.ok
|
||||
assert normalize_drive(p.path) in c.out
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
def test_pipenv_venv(PipenvInstance):
|
||||
with PipenvInstance() as p:
|
||||
p.pipenv('--python python')
|
||||
venv_path = p.pipenv('--venv').out.strip()
|
||||
c = p.pipenv('--python python')
|
||||
assert c.ok
|
||||
c = p.pipenv('--venv')
|
||||
assert c.ok
|
||||
venv_path = c.out.strip()
|
||||
assert os.path.isdir(venv_path)
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
def test_pipenv_py(PipenvInstance):
|
||||
with PipenvInstance() as p:
|
||||
p.pipenv('--python python')
|
||||
python = p.pipenv('--py').out.strip()
|
||||
c = p.pipenv('--python python')
|
||||
assert c.ok
|
||||
c = p.pipenv('--py')
|
||||
assert c.ok
|
||||
python = c.out.strip()
|
||||
assert os.path.basename(python).startswith('python')
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
def test_pipenv_support(PipenvInstance):
|
||||
with PipenvInstance() as p:
|
||||
assert p.pipenv('--support').out
|
||||
c = p.pipenv('--support')
|
||||
assert c.ok
|
||||
assert c.out
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
def test_pipenv_rm(PipenvInstance):
|
||||
with PipenvInstance() as p:
|
||||
p.pipenv('--python python')
|
||||
venv_path = p.pipenv('--venv').out.strip()
|
||||
c = p.pipenv('--python python')
|
||||
assert c.ok
|
||||
c = p.pipenv('--venv')
|
||||
assert c.ok
|
||||
venv_path = c.out.strip()
|
||||
assert os.path.isdir(venv_path)
|
||||
|
||||
assert p.pipenv('--rm').out
|
||||
c = p.pipenv('--rm')
|
||||
assert c.ok
|
||||
assert c.out
|
||||
assert not os.path.isdir(venv_path)
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
def test_pipenv_graph(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
p.pipenv('install requests')
|
||||
assert 'requests' in p.pipenv('graph').out
|
||||
assert 'requests' in p.pipenv('graph --json').out
|
||||
assert 'requests' in p.pipenv('graph --json-tree').out
|
||||
c = p.pipenv('install requests')
|
||||
assert c.ok
|
||||
c = p.pipenv("graph")
|
||||
assert c.ok
|
||||
graph = c.out
|
||||
c = p.pipenv("graph --json")
|
||||
assert c.ok
|
||||
graph_json = c.out
|
||||
c = p.pipenv("graph --json-tree")
|
||||
assert c.ok
|
||||
graph_json_tree = c.out
|
||||
assert 'requests' in graph
|
||||
assert 'requests' in graph_json`
|
||||
assert 'requests' in graph_json_tree
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
def test_pipenv_graph_reverse(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
p.pipenv('install requests==2.18.4')
|
||||
output = p.pipenv('graph --reverse').out
|
||||
c = p.pipenv('install requests==2.18.4')
|
||||
assert c.ok
|
||||
c = p.pipenv('graph --reverse')
|
||||
assert c.ok
|
||||
output = c.out
|
||||
|
||||
requests_dependency = [
|
||||
('certifi', 'certifi>=2017.4.17'),
|
||||
@@ -91,8 +119,10 @@ def test_pipenv_check(PipenvInstance, pypi):
|
||||
c = p.pipenv('check')
|
||||
assert c.return_code != 0
|
||||
assert 'requests' in c.out
|
||||
p.pipenv('uninstall requests')
|
||||
p.pipenv('install six')
|
||||
c = p.pipenv('uninstall requests')
|
||||
assert c.ok
|
||||
c = p.pipenv('install six')
|
||||
assert c.ok
|
||||
c = p.pipenv('check --ignore 35015')
|
||||
assert c.return_code == 0
|
||||
assert 'Ignoring' in c.err
|
||||
|
||||
Reference in New Issue
Block a user