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

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Sep 20 09:52:52 UTC 2016


On Sep 19, 2016 9:52 PM, "Mads Kiilerich" <mads at kiilerich.com> wrote:
>
> On 09/19/2016 09:34 PM, Thomas De Schampheleire wrote:
>>
>> On Sep 19, 2016 9:30 PM, "Mads Kiilerich" <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.)
>

In my reasoning I envisioned not touching the test files, which would
require __all__. In the pushed version, you did effectively fix the imports
from tests to tests.base, so I agree __all__ is no longer needed. Thanks
for taking care of it. I am now rebasing the tg branch on this and other
recent changes..

/Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20160920/c94bfae3/attachment.html>


More information about the kallithea-general mailing list