Repository: pypa/pip

Issue:
pip 9.0.1 - macOS tests fail with ConftestImportFailure
* Pip version: 9.0.1
* Python version: 2.7.12
* Operating System: macOS El Capitan (10.11.6)

### Description:
Cloned repo. Activated virtualenv.
Ran python setup.py test
Tests failed with ConftestImportFailure.

### What I've run:

python setup.py test
Complete paste at - http://pastebin.com/S2y0yPwt

```
==================================================================== test session starts =====================================================================
platform darwin -- Python 2.7.12, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: ~/code/pip, inifile: setup.cfg
collected 0 items / 1 errors 

=========================================================================== ERRORS ===========================================================================
_____________________________________________________________________ ERROR collecting  ______________________________________________________________________
.eggs/py-1.4.32-py2.7.egg/py/_path/common.py:366: in visit
    for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
.eggs/py-1.4.32-py2.7.egg/py/_path/common.py:415: in gen
    for p in self.gen(subdir):
.eggs/py-1.4.32-py2.7.egg/py/_path/common.py:415: in gen
    for p in self.gen(subdir):
.eggs/py-1.4.32-py2.7.egg/py/_path/common.py:415: in gen
    for p in self.gen(subdir):
.eggs/py-1.4.32-py2.7.egg/py/_path/common.py:415: in gen
    for p in self.gen(subdir):
.eggs/py-1.4.32-py2.7.egg/py/_path/common.py:415: in gen
    for p in self.gen(subdir):
.eggs/py-1.4.32-py2.7.egg/py/_path/common.py:405: in gen
    if p.check(dir=1) and (rec is None or rec(p))])
.eggs/pytest-3.0.5-py2.7.egg/_pytest/main.py:670: in _recurse
    ihook = self.gethookproxy(path)
.eggs/pytest-3.0.5-py2.7.egg/_pytest/main.py:575: in gethookproxy
    my_conftestmodules = pm._getconftestmodules(fspath)
.eggs/pytest-3.0.5-py2.7.egg/_pytest/config.py:339: in _getconftestmodules
    mod = self._importconftest(conftestpath)
.eggs/pytest-3.0.5-py2.7.egg/_pytest/config.py:364: in _importconftest
    raise ConftestImportFailure(conftestpath, sys.exc_info())
E   ConftestImportFailure: ImportError('No module named conftest',)
=================================================================== pytest-warning summary ===================================================================
WC1 None [pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================= 1 pytest-warnings, 1 error in 0.71 seconds =========================================================
```



Discussion:
Forgot to activate venv in the above post.
Did that now.
Same result.
Pastebin - http://pastebin.com/TPNerrF4

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -4,27 +4,11 @@
 import sys
 
 from setuptools import setup, find_packages
-from setuptools.command.test import test as TestCommand
 
 
 here = os.path.abspath(os.path.dirname(__file__))
 
 
-class PyTest(TestCommand):
-
-    def finalize_options(self):
-        TestCommand.finalize_options(self)
-
-        self.test_args = []
-        self.test_suite = True
-
-    def run_tests(self):
-        # import here, cause outside the eggs aren't loaded
-        import pytest
-
-        sys.exit(pytest.main(self.test_args))
-
-
 def read(*parts):
     # intentionally *not* adding an encoding option to open, See:
     #   https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690
@@ -96,5 +80,4 @@ def find_version(*file_paths):
     extras_require={
         'testing': tests_require,
     },
-    cmdclass={'test': PyTest},
 )


Test patch: