]> granicus.if.org Git - python/commit
Mock 100% coverage (GH-13045)
authorChris Withers <chris@withers.org>
Wed, 1 May 2019 22:04:04 +0000 (23:04 +0100)
committerGitHub <noreply@github.com>
Wed, 1 May 2019 22:04:04 +0000 (23:04 +0100)
commitadbf178e49113b2de0042e86a1228560475a65c5
tree871ac21aec993e310f915cf2781909282a7a03e9
parentb7378d77289c911ca6a0c0afaf513879002df7d5
Mock 100% coverage (GH-13045)

This was achieved by:
* moving many pass statements in tests onto their own lines, so they pass line coverage and can match an easy ignore pattern if branch coverage is added later.
* removing code that cannot be reached.
* removing long-disabled tests.
* removing unused code.
* adding tests for uncovered code

It turned out that removing `if __name__ == '__main__'` blocks that run unittest.main() at the bottom of test files was surprisingly contentious, so they remain and can be filtered out with an appropriate .coveragerc.
Lib/unittest/mock.py
Lib/unittest/test/testmock/support.py
Lib/unittest/test/testmock/testcallable.py
Lib/unittest/test/testmock/testhelpers.py
Lib/unittest/test/testmock/testmagicmethods.py
Lib/unittest/test/testmock/testmock.py
Lib/unittest/test/testmock/testpatch.py
Lib/unittest/test/testmock/testsealable.py
Lib/unittest/test/testmock/testwith.py