[TIP] py.test and Namespace Package issue

Ronny Pfannschmidt Ronny.Pfannschmidt at gmx.de
Tue Feb 26 08:06:25 PST 2013

Hi Tom,

this might be an issue with not taking the pretty strange behaviour of 
namespace packages in setuptools into account

can you report a bug and maybe provide a link to a project that uses it 
that way?

-- Ronny

On 02/26/2013 04:21 PM, Tom Davis wrote:
> I have a couple 2.7-style namespace packages, call 'em:
>      foo.web
>      foo.api
> Now, say I symlink web then api:
>      cd ~/foo/{web,api}&&  python setup.py develop
> If I now do `py.test --pyargs foo.web.tests`, the tests will fail with
> "ImportError: No module named web.tests.conftest". However! Either of
> these work fine:
>      python -mpytest
>      python setup.py test
> I narrowed this down to `py._path.pyimport()` and found that if I
> ensured that `pkgpath` is always `None`, it works. Oddly, all three
> methods appear to be going through the same code path.
> I also discovered that deleting __init__.py from the `tests` directories
> also fixed it.
> I'm not sure if this is a bug or just an oddity of namespace packages.
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python

More information about the testing-in-python mailing list