[py-dev] Problems with test discovery (ImportError)

Hans Meine meine at informatik.uni-hamburg.de
Thu May 20 13:12:16 CEST 2010


On Thursday 20 May 2010 12:49:31 holger krekel wrote:
> On Thu, May 20, 2010 at 12:43 +0200, Hans Meine wrote:
> > [...] py.test fails with
> > 
> > E           ImportError: No module named something.test_foo
> > 
> > [...]
> > 
> > Obviously, this is a bug that should be fixed, but I would already happy
> > if you could tell me a workaround (i.e. different invocation of py.test,
> > without changing the directory name of course).
> 
> The error message is a bit obscure but scrolling a bit up you see
> that py.test tries to import  'io.something.test_foo'

Can I circumvent this?  (IIRC, for instance nosetests differentiates between 
full filenames and importable module names.)

> - i.e. you have created a package 'io' and that overlaps with the standard
> library's 'io' package.

Ah, bad.  But I won't change that now, after using the name myself for several 
years already.  Who needs stdlib's io anyway.. ;-p

Another workaround is to prepend my main package directory to PYTHONPATH 
(tested, works -> fine).

Thanks for the explanation,
  Hans

PS: No need to CC me anymore, the list turned out to be subscribers-only. :-/



More information about the Pytest-dev mailing list