[Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest files
Stephen J. Turnbull
turnbull.stephen.fw at u.tsukuba.ac.jp
Wed May 1 16:21:56 EDT 2019
Chris Withers writes:
> On 01/05/2019 17:09, Stephen J. Turnbull wrote:
> > Executive summary:
> >
> > "There should be a tool" (sorry, I'm not volunteering any time soon)
> > that could be added to $VCS diff (say, "git coverage-diff" or "git
> > diff --coverage").
>
> That sounds like a very hard problem to solve...
I would say "compute-intensive" and "refactor-discouraging".
Presumably a detailed coverage report would identify missing coverage
by unit (line, function, branch), and if there was a canonical
ordering on units those reports could be text diffed. Of course most
refactorings will break that -- maybe that would be useless, but most
refactorings will break any diff and we still manage to find them
useful. I don't know enough to guess: such considerations are why I'm
explicitly refusing to volunteer....
> Right, but the more we discuss this, the stronger my feeling that
> these should be removed everywhere, rather than just the few in
> unittest.test.test_mock that I intend to remove.
I personally don't have a problem with that proposal or "Chris's
feeling as sufficient condition" in practice, as I don't run tests
that way (they frequently don't have an appropriate script interface,
so I never developed the habit). My point was more that different
people have different feelings about this, and there's some "talking
past" going on because the concrete basis for those increasingly
strong feelings on both sides seems to mostly be "I haven't heard any
concrete reasons to change my mind (and likely more important, my way
of doing things) so my original reasons carry the issue".
Steve
More information about the Python-Dev
mailing list