Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2018-11-23 18:06:12 -05:00
parent ef42f84427
commit 2b1ea9ee8a
+23
View File
@@ -1,5 +1,6 @@
import pytest
import os
import sys
from pipenv.utils import temp_environ
@@ -517,3 +518,25 @@ def test_lock_no_warnings(PipenvInstance, pypi):
assert "Warning" in c.err
assert "Warning" not in c.out
assert "hello" in c.out
@pytest.mark.lock
@pytest.mark.install
@pytest.mark.skipif(sys.version_info >= (3, 5), reason="scandir doesn't get installed on python 3.5+")
def test_lock_missing_cache_entries_gets_all_hashes(monkeypatch, PipenvInstance, pypi, tmpdir):
"""
Test locking pathlib2 on python2.7 which needs `scandir`, but fails to resolve when
using a fresh dependency cache.
"""
with monkeypatch.context() as m:
monkeypatch.setattr("pipenv.patched.piptools.locations.CACHE_DIR", tmpdir.strpath)
with PipenvInstance(pypi=pypi, chdir=True) as p:
p._pipfile.add("pathlib2", "*")
assert "pathlib2" in p.pipfile["packages"]
c = p.pipenv("install")
assert c.return_code == 0, c.err
assert "pathlib2" in p.lockfile["default"]
assert "scandir" in p.lockfile["default"]
assert isinstance(p.lockfile["default"]["scandir"]["hashes"], list)
assert len(p.lockfile["default"]["scandir"]["hashes"]) > 1