[py-dev] py.path import hook for getpymodule()

holger krekel hpk at trillke.net
Tue Nov 9 15:19:00 CET 2004


Hi Armin, 

[Armin Rigo Tue, Nov 09, 2004 at 01:47:29PM +0000]
> On Tue, Nov 09, 2004 at 12:14:20PM +0100, holger krekel wrote:
> > Of course, if you don't apply initpkg() then your above view of separation 
> > between tests and the rest of your package should still be true. 
> 
> Actually, in that view, the test files would contain import statements to
> import the package they test; such import statements would then be
> getpymodule()ed as well, ... 

Hehe, that's a funny but maybe also a dangerous or at least
fragile side effect.  I realize that you are already trying to
handle absolute imports if they relate to the pkgdir.  Btw, i
think your patch needs to look into pkgdir.dirpath() because
pkgdir itself really is the directory of the package and not
the directory containing the package.  But you would have
catched that with an appropriate test :-) 

    holger



More information about the Pytest-dev mailing list