__all__ attribute: bug and proposal

Terry Reedy tjreedy at udel.edu
Mon Jun 27 22:46:43 EDT 2016

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.

Terry Jan Reedy

More information about the Python-list mailing list