--- you can reply above this line ---

New issue 121: py.test seems gather tests from upper directories
http://bitbucket.org/hpk42/py-trunk/issue/121/pytest-seems-gather-tests-from-upper

bluebird75 on Mon, 27 Sep 2010 11:35:10 +0200:

Description:
  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

hili...@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/     

phili...@pc-philippe /cygdrive/d/work/elc-dev $ cd elc1                         
           
phili...@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\pytest_default.py:57:
 DeprecationWarning: <class 'conftest.Directory'> was found in a conftest.py 
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\py.test-script.py", 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\pytest.py", 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\cmdline.py", 
line 16, in 
main                                                                            
           
    colitems = config.getinitialnodes()                                         
           
  File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py\_test\config.py", 
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\config.py", 
line 173, in 
getnode                                                                         
           
    return self._rootcol.getbynames(names)                                      
           
  File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py\_test\collect.py", 
line 388, in getbynames                                                         
                       
    for x in current._memocollect():                                            
           
  File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py\_test\collect.py", 
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\collect.py", 
line 104, in _memoizedcall                                                      
                       
    res = function()                                                            
           
  File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py\_test\collect.py", 
line 300, in collect                                                            
                       
    res = self.consider(path)                                                   
           
  File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py\_test\collect.py", 
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\collect.py", 
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\pluginmanager.py", 
line 354, in pcall                                                              
                 
    return self.hookrelay._performcall(self.name, mc)                           
           
  File 
"C:\Python26\lib\site-packages\py-1.3.4-py2.6.egg\py\_test\pluginmanager.py", 
line 335, in _performcall                                                       
                 
    return multicall.execute()                                                  
           
  File 
"C:\Python26\lib\site-packages\py-1.3.4-py2.6.egg\py\_test\pluginmanager.py", 
line 244, in execute                                                            
                 
    res = method(**kwargs)                                                      
           
  File 
"c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py\_plugin\pytest_default.py",
 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\config.py", 
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\conftesthandle.py", 
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\conftesthandle.py", 
line 
72, in getconftestmodules                                                       
           
    clist.append(self.importconftest(conftestpath))                             
           
  File 
"c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py\_test\conftesthandle.py", 
line 
108, in importconftest                                                          
           
    mod = conftestpath.pyimport()                                               
           
  File "c:\python26\lib\site-packages\py-1.3.4-py2.6.egg\py\_path\local.py", 
line 540, in pyimport                                                           
                         
    raise self.ImportMismatchError(modname, modfile, self)                      
           
py._path.local.ImportMismatchError: ('conftest', 'd:\\work\\elc-dev\\Copy of 
git-linkchecker\\conftest.py', 
local('d:\\work\\elc-dev\\elc-memory\\conftest.py'))                      
phili...@pc-philippe /cygdrive/d/work/elc-dev/elc1 $    
}}}


The errors reported below belong to other directories than elc1.


I have a conftest.py in elc1:

{{{
#!python

phili...@pc-philippe /cygdrive/d/work/elc-dev/elc1 $ cat conftest.py            
           
                                                                                
           
# 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/' ]                             
           
                                                                                
           
DB_TEST_ENV = None                                                              
           
                                                                                
           
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'                                           
           
        DB_TEST_ENV.setup()                                                     
           
                                                                                
           
def pytest_sessionfinish( session, exitstatus ):                                
           
        # print 'pytest_sessionfinish'                                          
           
        DB_TEST_ENV.teardown()                                                  
           
        pass                                                                    
           
                                                                         
}}}


Responsible:
  hpk42
-- 
This is an issue notification from bitbucket.org.
You are receiving this either because you are the
owner of the issue, or you are following the issue.
_______________________________________________
py-dev mailing list
py-dev@codespeak.net
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to