__all__ attribute: bug and proposal

Steven D'Aprano steve at pearwood.info
Mon Jun 27 23:24:51 EDT 2016


On Tue, 28 Jun 2016 12:46 pm, Terry Reedy wrote:

> On 6/27/2016 6:29 PM, Pavel S wrote:
> 
>> Frankly, do you always unit-test if __all__ works?
> 
> One should.  CPython's test suite includes test___all__.  I believe it
> imports every stdlib module, looks for __all__, and if present, tests
> that it works.  It probably executes 'from module import *'.  A side
> effect is testing that everything imports.  I am pretty sure that
> test___all__ has caught bugs.

I write my own unit tests for __all__, which has certainly caught bugs.



-- 
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list