Repository: pypa/pipenv

Issue:
mercury CI is always failing
I've open several pull requests during past couple of days. yet the mercury CI is still failing with "0 tests run, 0 skipped, 0 failed."


Discussion:
Yeah, it's an extra CI build server in Kenneth's living room.  I'm pretty sure there's some extra process that happens and I'm not totally clear on why it's failing, but you can click through to see the test results (they are actually all good, usually)

Resolving patch:
diff --git a/pipenv/core.py b/pipenv/core.py
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -15,10 +15,10 @@
 import crayons
 import dotenv
 import delegator
-import pexpect
+from .vendor import pexpect
 import pipfile
 import pipdeptree
-from pipreqs import pipreqs
+from .vendor.pipreqs import pipreqs
 from blindspin import spinner
 
 from requests.packages import urllib3
@@ -183,7 +183,7 @@ def cleanup_virtualenv(bare=True):
 
 def import_requirements(r=None, dev=False):
     import pip9
-    from pip9.req.req_file import parse_requirements
+    from .vendor.pip9.req.req_file import parse_requirements
 
     # Parse requirements.txt file with Pip's parser.
     # Pip requires a `PipSession` which is a subclass of requests.Session.
@@ -1464,6 +1464,7 @@ def pip_install(
     return c
 
 
+
 def pip_download(package_name):
     for source in project.sources:
         cmd = '{0} download "{1}" -i {2} -d {3}'.format(
@@ -2079,7 +2080,7 @@ def do_uninstall(
 
 
 def do_shell(three=None, python=False, fancy=False, shell_args=None):
-    from pipenv.patched.pew import pew
+    from .patched.pew import pew
 
     # Ensure that virtualenv is available.
     ensure_project(three=three, python=python, validate=False)
diff --git a/pipenv/project.py b/pipenv/project.py
--- a/pipenv/project.py
+++ b/pipenv/project.py
@@ -19,7 +19,7 @@
 except ImportError:
     import pathlib2 as pathlib
 
-from pip9 import ConfigOptionParser
+from .vendor.pip9 import ConfigOptionParser
 from .cmdparse import Script
 from .utils import (
     mkdir_p,
@@ -218,7 +218,7 @@ def virtualenv_exists(self):
 
     @classmethod
     def _get_virtualenv_location(cls, name):
-        from pipenv.patched.pew.pew import get_workon_home
+        from .patched.pew.pew import get_workon_home
         venv = get_workon_home() / name
         if not venv.exists():
             return ''
@@ -262,7 +262,7 @@ def get_name(name, location):
             return clean_name, encoded_hash
 
         # Check for different capitalization of the same project.
-        from pipenv.patched.pew.pew import lsenvs
+        from .patched.pew.pew import lsenvs
         for env in lsenvs():
             try:
                 env_name, hash_ = env.rsplit('-', 1)
diff --git a/pipenv/utils.py b/pipenv/utils.py
--- a/pipenv/utils.py
+++ b/pipenv/utils.py
@@ -20,7 +20,7 @@
     from weakref import finalize
 except ImportError:
     try:
-        from backports.weakref import finalize
+        from .vendor.backports.weakref import finalize
     except ImportError:
         class finalize(object):
             def __init__(self, *args, **kwargs):
@@ -40,20 +40,20 @@ def detach(self):
     from pathlib import Path
 except ImportError:
     try:
-        from pathlib2 import Path
+        from .vendor.pathlib2 import Path
     except ImportError:
         pass
 from distutils.spawn import find_executable
 from contextlib import contextmanager
-from pipenv.patched.piptools.resolver import Resolver
-from pipenv.patched.piptools.repositories.pypi import PyPIRepository
-from pipenv.patched.piptools.scripts.compile import get_pip_command
-from pipenv.patched.piptools import logging as piptools_logging
-from pipenv.patched.piptools.exceptions import NoCandidateFound
-from pip9.download import is_archive_file
-from pip9.exceptions import DistributionNotFound
-from pip9.index import Link
-from pip9._vendor.requests.exceptions import HTTPError, ConnectionError
+from .patched.piptools.resolver import Resolver
+from .patched.piptools.repositories.pypi import PyPIRepository
+from .patched.piptools.scripts.compile import get_pip_command
+from .patched.piptools import logging as piptools_logging
+from .patched.piptools.exceptions import NoCandidateFound
+from .vendor.pip9.download import is_archive_file
+from .vendor.pip9.exceptions import DistributionNotFound
+from .vendor.pip9.index import Link
+from .vendor.pip9._vendor.requests.exceptions import HTTPError, ConnectionError
 
 from .pep508checker import lookup
 from .environments import PIPENV_MAX_ROUNDS, PIPENV_CACHE_DIR
@@ -72,8 +72,8 @@ class ResourceWarning(Warning):
 
 
 def get_requirement(dep):
-    from pip9.req.req_install import _strip_extras, Wheel
-    import requirements
+    from .vendor.pip9.req.req_install import _strip_extras, Wheel
+    from .vendor import requirements
     """Pre-clean requirement strings passed to the requirements parser.
 
     Ensures that we can accept both local and relative paths, file and VCS URIs,
@@ -789,7 +789,7 @@ def is_editable(pipfile_entry):
 
 
 def is_vcs(pipfile_entry):
-    from pipenv.vendor import requirements
+    from .vendor import requirements
 
     """Determine if dictionary entry from Pipfile is for a vcs dependency."""
     if hasattr(pipfile_entry, 'keys'):
@@ -807,8 +807,8 @@ def is_vcs(pipfile_entry):
 
 def is_installable_file(path):
     """Determine if a path can potentially be installed"""
-    from pip9.utils import is_installable_dir
-    from pip9.utils.packaging import specifiers
+    from .vendor.pip9.utils import is_installable_dir
+    from .vendor.pip9.utils.packaging import specifiers
 
     if hasattr(path, 'keys') and any(
         key for key in path.keys() if key in ['file', 'path']
@@ -859,7 +859,7 @@ def is_file(package):
 
 def pep440_version(version):
     """Normalize version to PEP 440 standards"""
-    from pip9.index import parse_version
+    from .vendor.pip9.index import parse_version
 
     # Use pip built-in version parser.
     return str(parse_version(version))


Test patch:
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py
new file mode 100644
diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py
new file mode 100644