$py.test
==================================================================== test session starts =====================================================================
platform darwin -- Python 2.7.3 -- pytest-2.3.4
collected 0 items / 1 errors
=========================================================================== ERRORS ===========================================================================
_____________________________________________________________________ ERROR collecting . _____________________________________________________________________
/sw/lib/python2.7/site-packages/py/_path/common.py:315: in visit
> for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/sw/lib/python2.7/site-packages/py/_path/common.py:361: in gen
> for p in self.gen(subdir):
/sw/lib/python2.7/site-packages/py/_path/common.py:351: in gen
> if p.check(dir=1) and (rec is None or rec(p))])
/sw/lib/python2.7/site-packages/_pytest/main.py:546: in _recurse
> ihook.pytest_collect_directory(path=path, parent=self)
/sw/lib/python2.7/site-packages/_pytest/main.py:156: in call_matching_hooks
> plugins = self.config._getmatchingplugins(self.fspath)
/sw/lib/python2.7/site-packages/_pytest/config.py:319: in _getmatchingplugins
> plugins += self._conftest.getconftestmodules(fspath)
/sw/lib/python2.7/site-packages/_pytest/config.py:214: in getconftestmodules
> clist.append(self.importconftest(conftestpath))
/sw/lib/python2.7/site-packages/_pytest/config.py:243: in importconftest
> self._conftestpath2mod[conftestpath] = mod = conftestpath.pyimport()
/sw/lib/python2.7/site-packages/py/_path/local.py:551: in pyimport
> raise self.ImportMismatchError(modname, modfile, self)
E ImportMismatchError: ('sympy.conftest', '/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/conftest.py', local('/Users/aaronmeurer/Documents/Python/sympy/sympy/py3k-sympy/sympy/conftest.py'))
DO *NOT* COMMIT!
================================================================== 1 error in 1.49 seconds ===================================================================
It seems to be confused about which conftest to use between the one in sympy/ and the one in py3k-sympy/.
Original issue for #6817: http://code.google.com/p/sympy/issues/detail?id=3718
Original author: https://code.google.com/u/[email protected]/
It does work for py.test version >= 2.5.2:
$ py.test
============================================================================= test session starts ==============================================================================
platform linux2 -- Python 2.7.3 -- py-1.4.20 -- pytest-2.5.2
plugins: cov
collected 6418 items / 1 skipped
sympy/assumptions/tests/test_assumptions_2.py .....
sympy/assumptions/tests/test_context.py ....
sympy/assumptions/tests/test_matrices.py ...x........x..^C
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/usr/lib/python2.7/threading.py:154: KeyboardInterrupt
But it doesn't for pytest-2.2.4 with different error (c.f. the issue description):
$ py.test
============================================================================= test session starts ==============================================================================
platform linux2 -- Python 2.7.3 -- pytest-2.2.4
collected 0 items / 1 errors
==================================================================================== ERRORS ====================================================================================
______________________________________________________________________________ ERROR collecting . ______________________________________________________________________________
/usr/lib/python2.7/dist-packages/py/_path/common.py:315: in visit
> for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/usr/lib/python2.7/dist-packages/py/_path/common.py:351: in gen
> if p.check(dir=1) and (rec is None or rec(p))])
/usr/lib/python2.7/dist-packages/_pytest/main.py:484: in _recurse
> ihook.pytest_collect_directory(path=path, parent=self)
/usr/lib/python2.7/dist-packages/_pytest/main.py:140: in call_matching_hooks
> plugins = self.config._getmatchingplugins(self.fspath)
/usr/lib/python2.7/dist-packages/_pytest/config.py:289: in _getmatchingplugins
> plugins += self._conftest.getconftestmodules(fspath)
/usr/lib/python2.7/dist-packages/_pytest/config.py:188: in getconftestmodules
> clist.append(self.importconftest(conftestpath))
/usr/lib/python2.7/dist-packages/_pytest/config.py:217: in importconftest
> self._conftestpath2mod[conftestpath] = mod = conftestpath.pyimport()
/usr/lib/python2.7/dist-packages/py/_path/local.py:532: in pyimport
> __import__(modname)
sympy/conftest.py:64: in <module>
> @pytest.fixture(autouse=True, scope='module')
E AttributeError: 'module' object has no attribute 'fixture'
=========================================================================== 1 error in 0.86 seconds ===========================
@asmeurer, should we close this issue and fix py.test requirements?
I get
$py.test
==================================================================== test session starts =====================================================================
platform darwin -- Python 3.4.1 -- py-1.4.25 -- pytest-2.6.3
collected 0 items / 1 errors
=========================================================================== ERRORS ===========================================================================
_____________________________________________________________________ ERROR collecting . _____________________________________________________________________
../../../../anaconda3/lib/python3.4/site-packages/py/_path/common.py:331: in visit
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
../../../../anaconda3/lib/python3.4/site-packages/py/_path/common.py:377: in gen
for p in self.gen(subdir):
../../../../anaconda3/lib/python3.4/site-packages/py/_path/common.py:377: in gen
for p in self.gen(subdir):
../../../../anaconda3/lib/python3.4/site-packages/py/_path/common.py:366: in gen
dirs = self.optsort([p for p in entries
../../../../anaconda3/lib/python3.4/site-packages/py/_path/common.py:367: in <listcomp>
if p.check(dir=1) and (rec is None or rec(p))])
../../../../anaconda3/lib/python3.4/site-packages/_pytest/main.py:628: in _recurse
ihook.pytest_collect_directory(path=path, parent=self)
../../../../anaconda3/lib/python3.4/site-packages/_pytest/main.py:166: in call_matching_hooks
plugins = self.config._getmatchingplugins(self.fspath)
../../../../anaconda3/lib/python3.4/site-packages/_pytest/config.py:688: in _getmatchingplugins
plugins += self._conftest.getconftestmodules(fspath)
../../../../anaconda3/lib/python3.4/site-packages/_pytest/config.py:521: in getconftestmodules
mod = self.importconftest(conftestpath)
../../../../anaconda3/lib/python3.4/site-packages/_pytest/config.py:545: in importconftest
raise ConftestImportFailure(conftestpath, sys.exc_info())
E _pytest.config.ConftestImportFailure: (local('/Users/aaronmeurer/Documents/Python/sympy/sympy-scratch/build/lib/sympy/conftest.py'), (<class 'py._path.local.LocalPath.ImportMismatchError'>, ImportMismatchError('sympy.conftest', '/Users/aaronmeurer/Documents/Python/sympy/sympy-scratch/sympy/conftest.py', local('/Users/aaronmeurer/Documents/Python/sympy/sympy-scratch/build/lib/sympy/conftest.py')), <traceback object at 0x106a35088>))
DO *NOT* COMMIT!
================================================================== 1 error in 0.71 seconds ===================================================================
I delete .cache dir, run
pip uninstall pytest
pip install pytest
And it works without ImportMismatchError
Most helpful comment
I delete
.cachedir, runAnd it works without
ImportMismatchError