[Distutils] distlib updated - comments sought

Vinay Sajip vinay_sajip at yahoo.co.uk
Fri Oct 5 12:19:59 CEST 2012


Tarek Ziadé <tarek <at> ziade.org> writes:

> I like the idea of having a main section to play with the tools, people 
> can invoke with -m
> 
> I don't think its a bad idea to have it in each module, like what Python 
> does
> for SimpleHTTPServer or json.tools
> 

I've no problem with having a "if __name == '__main__'" section, but I don't
think it should need to be unit tested, or form part of the contract of the
module. For example, the depgraph.main() test as it stands is dependent on
whatever happens to be on sys.path on the machine running the test, possibly
leading to results unreproducible by different people. For example, on my
machine, the test originally failed because of version numbers of legacy
distributions on sys.path, which didn't meet PEP 386 standards and led to
exceptions being raised in depgraph.main(). I commented out the "raise" and
replaced it with a "continue", and the test then passed.

Regards,

Vinay Sajip



More information about the Distutils-SIG mailing list