A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2019-May/157269.html below:

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

[Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest filesChris Withers chris at withers.org
Wed May 1 08:51:22 EDT 2019
On 01/05/2019 13:37, Paul Moore wrote:
> I agree - removing this just to make the coverage figures look pretty
> seems like the wrong motivation.
> 
> Configuring coverage to understand that you want to exclude these
> lines from the checking would be fine, as would accepting that a
> coverage of slightly less than 100% is OK. Removing functionality that
> people use (whether or not they have other ways of getting the same
> results) needs a stronger justification, IMO.

It's an interesting point; I personally don't see much value in coverage 
of less than 100%, if you're going to look at coverage: no-one is going 
to focus on or potentially even notice whether coverage moved from 99% 
to 99% (no typo), even though a bunch of new uncovered code may have 
been introduced.

If people are actually using these blocks, then so be it, but it feels 
like the people who want them to stick around are saying they're using 
them just on the off chance they might use them, which feels like a poor 
reason to keep a bunch of dead code around.

I'm not sure I understand how triggering via unittest or via unittest 
(again, no typo, both these __main__ blocks and python -m unittest are 
using the same test runner) could make a difference.

Chris
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4