[TIP] Multiplatform testing with nose

Jonathan Lange jml at mumak.net
Tue Feb 15 03:23:23 PST 2011


On Tue, Feb 15, 2011 at 11:19 AM, Michael Foord
<fuzzyman at voidspace.org.uk> wrote:
> On 14/02/2011 21:53, Éric Araujo wrote:
>>
>> Le 14/02/2011 18:45, holger krekel a écrit :
>>>
>>> Besides, it's always good to avoid code in __init__.py
>>> files including imports.
>>
>> Could you elaborate on the reasons for that?  This has come up recently
>> on another ML, python-dev I think, and the only rationale was use of
>> setuptools namespace packages.
>
> Seeing lots of code in an __init__.py always offends me, but I'm not sure I
> can fully rationalise it. :-)
>

My favorite reason is that the code in __init__ is *always* executed
if you import a module within that package. The more code you have
there, the less independence each module has. This most frequently
bites me by generating silly circular import errors.

jml



More information about the testing-in-python mailing list