[Python-ideas] Make Difflib example callable as module __main__
solipsis at pitrou.net
Thu Feb 23 19:21:33 CET 2012
On Thu, 23 Feb 2012 08:08:08 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Thu, Feb 23, 2012 at 7:40 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> > If you run difflib directly, it runs difflib._test. which runs a doctest on
> > difflib. Most modules do something similar. Having a real command-line
> > interface in the module itself is unusual.
> That's largely a historical artifact though - prior to -m direct
> execution was a pain, so the only time it really happened was in a
> source checkout during development. (plus I don't believe regrtest
> always had selective test execution, so run the library directly was a
> good way to only run some of the tests).
> If there's useful functionality that can be provided via -m, I'm a fan
> of moving tests out of the way to make room for it (it's also a good
> opportunity to make sure regrtest is covering whatever __main__
> execution tests).
+1 for moving self-tests to the regular test suite. Nobody, and
especially not the buildbots, runs self-tests included in __main__
(and, as a matter of fact, many of those may be broken without anyone
More information about the Python-ideas