On Fri, Jun 25, 2010 at 18:02 +0200, Frank Hempel wrote:
> Am 25.06.2010 16:19, schrieb holger krekel:
> > 
> > It internally needs to perform a collection on the ROOTDIR 
> > in order to "select" 'a'.  In fact, the reason behind all this is that
> > py.test tries to construct a *canonical* collection tree up to the command
> > line specified argument and this three starts from the ROOTDIR / root node 
> > which is indeed determined as the last non-init-containing directory. 
> > 
> >> I hope I could make my concern clearer now.
> > 
> > I think so - your analysis is right - i guess i didn't succeed yet in
> > explaining the logic/reasoning behind the current behaviour, hope it's
> > clearer now. 
> 
> Ok. Thanks so far for taking the time and explaining this.
> 
> Nevertheless i'm not absolutely happy with the situation that all
> directories of the "first non-init-containing directory" (should be
> called first, right?) are considered for conftest-loading.
> Because without changing anything to one's project 'a' it can make a
> difference in the sense of tests passing or failing for the project 'a'
> in dependency of what other project folders one puts side-by-side to 'a'.
> One not too unlikely side effect could be: the pytest_configure function
> of each conftest.py (the one of folder 'a' and of 'b') sets something to
> sys.path with a commonly used statement like "sys.path.insert(*0*,
> ...)". When testing project 'a' and with the fact that the order of the
> conftest-loadings is that "b"'s will be loaded after "a"'s, the
> sys.path.insertion of 'b' will take precedence. Regardless of the fact
> the the project 'b' might have have nothing to do with project 'a', it
> just sits side-by-side in the filesystem. And i'm actually not
> complaining th order. For my expectaion "b"'s conftest should not be
> loaded at all if i'm testing 'a' and the containing directory of 'a' and
> 'b' does not contain an __init__.py.
> 
> ...do you agree with that :) ?

Somewhat although i consider it bad practise to do sys.path manipulations
in pytest_configure.  It probably also means that you can get trouble when
you run things from the root dir and both the 'a' and 'b' tests are run. 
Anyway, i agree it'd be nicer if py.test would not implicitely load the
sibling directory's conftest.py.  Could you care to file an "enhancement" 
issue in the bitbucket tracker?  If you add a test case that you'd like to 
work that'd be good.  I am not sure i fix it for the soon upcoming minor 
release but i definitely give it a try for 1.4. 

best,
holger
_______________________________________________
py-dev mailing list
py-dev@codespeak.net
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to