[Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest files

Stephen J. Turnbull turnbull.stephen.fw at u.tsukuba.ac.jp
Sat May 4 17:02:47 EDT 2019

Terry Reedy writes:

 > I agree that complete 100.000% test coverage is a nice ideal, but
 > sometimes the last percent can take hours to accomplish, if it is
 > indeed sensibly possible.

100% test coverage is an ideal.  Reports *claiming* 100% coverage,
however, are of practical benefit.  The point is to identify a

It's best to have 100% coverage, because it's possible that
improvements in the environment allow a test that wasn't reliable (==
deterministic) or maybe not even feasible before to become feasible
and reliable, and a coveragerc that says "oh, that line is OK" will
obscure that possibility.

But a *claim* (albeit somewhat undermined by a non-trivial coveragerc)
of 100% coverage means it's *easy to identify regressions in
coverage*.  I think that's a bigger deal, at least at this time.

 > I have asked more that once what .coveragerc file is being used by
 > CI and whether we can somehow properly customize it for CPython.

Seconded.  Thank you for pushing this, and for all the other efforts
you're making here.


More information about the Python-Dev mailing list