A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2019-May/157259.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 files [Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest filesTerry Reedy tjreedy at udel.edu
Wed May 1 01:12:10 EDT 2019
On 4/30/2019 5:24 PM, Chris Withers wrote:
> Hi All,
> 
> I have a crazy idea of getting unittest.mock up to 100% code coverage.
> 
> I noticed at the bottom of all of the test files in testmock/, there's a:
> 
> if __name__ == '__main__':
>      unittest.main()
> 
> ...block.

Such blocks should be excluded from coverage by the default .coveragerc 
file.  Mine came with

exclude_lines =
     # Don't complain if non-runnable code isn't run:
     if 0:
     if __name__ == .__main__.:
     if DEBUG:


-- 
Terry Jan Reedy


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