Usual practice: running/testing modules in a package

Medardo Rodriguez (Merchise Group) med.swl at gmail.com
Fri Aug 22 16:31:58 EDT 2008


On Fri, Aug 22, 2008 at 1:25 PM, Gabriel Genellina
<gagsl-py2 at yahoo.com.ar> wrote:
> what if __init__.py contains code?

Thats what I usually do to solve the "problem", but for my taste it's
better to write the test code of a module inside it.
The code I write in "__init__.py" is related to structures of
initializations, globals at package level.

if __name__ == "__main__":
    pass # Here I test only concepts related to the entire package,
not to any module.

Regards



More information about the Python-list mailing list