[PATCH 1 of 2 v4] tests: add as little code as possible in __init__.py

Mads Kiilerich mads at kiilerich.com
Mon Sep 19 19:52:55 UTC 2016


On 09/19/2016 09:34 PM, Thomas De Schampheleire wrote:
>
> On Sep 19, 2016 9:30 PM, "Mads Kiilerich" <mads at kiilerich.com 
> <mailto:mads at kiilerich.com>> wrote:
>
> >> +from kallithea.tests.base import *
> >
> >
> > Would you have any objections to dropping this and just use 
> kallithea.tests.base where it is needed?
> >
> > Import * in general is one thing, but having it in a module 
> definition can make it even harder to figure out what is going on.
>
> Does that work with the override of __all__? That is the real reason 
> to import this way. If there is a better way, yes please.
>

We only need __all__ in a module when we do 'import *' from it. And as I 
propose it, there would be no 'import *' from __init__.py but from base.py.

(Also __all__ in base.py will unambiguously be everything, and there is 
thus not need for it. Unless we like explicit.)

/Mads

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20160919/9a046660/attachment.html>


More information about the kallithea-general mailing list