py.test seems gather tests from upper directories

Create issue
Issue #121 duplicate
Bluebird created an issue

I don't know what's wrong with my setup, but since I upgraded py.test , it no longer restrict itself to the current directory and subdirectories, it looks up for other directories.

{{{ #!bash

hilippe@pc-philippe /cygdrive/d/work/elc-dev $ ls -d elc*
elc-memory/ elc-py26/ elc-work-fh1/ elc2/
elc-merge-linkchecker/ elc-ref/ elc1/ elc3/

Philippe@pc-philippe /cygdrive/d/work/elc-dev $ cd elc1
Philippe@pc-philippe /cygdrive/d/work/elc-dev/elc1 $ py.test
2010-09-27 11:30:59,592 5404 INFO elc.ElcLogger init_logging_local done
C:\Python26\lib\site-packages\py-1.3.4-py2.6.egg\py_plugin\ DeprecationWarning: <class 'conftest.Directory'> was found in a file, use pytest_collect hooks instead. (since version >1.1)
Directory = parent.config._getcollectclass('Directory', path)
Traceback (most recent call last):
File "c:\Python26\Scripts\", line 8, in <module>
load_entry_point('py==1.3.4', 'console_scripts', 'py.test')()
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_cmdline\", line 5, in main
raise SystemExit(py.test.cmdline.main(args))
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 16, in main
colitems = config.getinitialnodes()
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 158, in getinitialnodes
return [self.getnode(arg) for arg in self.args]
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 173, in getnode
return self._rootcol.getbynames(names)
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 388, in getbynames
for x in current._memocollect():
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 230, in _memocollect
return self._memoizedcall('_collected', self.collect)
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 104, in _memoizedcall
res = function()
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 300, in collect
res = self.consider(path)
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 309, in consider
if self.ihook.pytest_ignore_collect(path=path, config=self.config):
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 21, in call_matching_hooks
return hookmethod.pcall(plugins, kwargs)
File "C:\Python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 354, in pcall
return self.hookrelay._performcall(, mc)
File "C:\Python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 335, in _performcall
return multicall.execute()
File "C:\Python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 244, in execute
res = method(
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_plugin\", line 32, in pytest_ignore_collect
ignore_paths = config.getconftest_pathlist("collect_ignore", path=path)
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 195, in getconftest_pathlist
mod, relroots = self._conftest.rget_with_confmod(name, path)
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 88, in rget_with_confmod
modules = self.getconftestmodules(path)
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 72, in getconftestmodules
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_test\", line 108, in importconftest
mod = conftestpath.pyimport()
File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py_path\", line 540, in pyimport
raise self.ImportMismatchError(modname, modfile, self)
py._path.local.ImportMismatchError: ('conftest', 'd:\work\elc-dev\Copy of git-linkchecker\', local('d:\work\elc-dev\elc-memory\'))
Philippe@pc-philippe /cygdrive/d/work/elc-dev/elc1 $

The errors reported below belong to other directories than elc1.

I have a in elc1:

{{{ #!python

Philippe@pc-philippe /cygdrive/d/work/elc-dev/elc1 $ cat

this module is loaded by py.test before running the tests

import fix_path
import elcloginit

import tests.httpd_utils as httpd_utils
from tests.setupDbTestEnv import SetupDbTestEnv, envDict

collect_ignore = [ 'elc_linkchecker/linkchecker/' ]


def pytest_namespace():
global DB_TEST_ENV
DB_TEST_ENV = SetupDbTestEnv()
envDict[ 'dbTestEnv' ] = DB_TEST_ENV
return envDict

def pytest_sessionstart( session ):
# print 'pytest_sessionstart'

def pytest_sessionfinish( session, exitstatus ):
# print 'pytest_sessionfinish'


Comments (2)

  1. Holger Krekel repo owner
    • changed status to open

    Thanks for reporting. I wonder if it was really 1.3.4 that introduced the problem - i am not aware of it.

    In any case, issue #109 gives a bit more details. We need to fix it up - i'll see to do that for the next release.

  2. Log in to comment