Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/997380?usp=email )
Change subject: [coverage] exclude lines "if __name__ == '__main__':" from coverage ......................................................................
[coverage] exclude lines "if __name__ == '__main__':" from coverage
Change-Id: I047909d281cf55d6494435fdd9b62cbd13e1352a --- M .coveragerc M pywikibot/config.py M pywikibot/scripts/shell.py M setup.py M tests/__init__.py M tests/add_text_tests.py M tests/api_tests.py M tests/archivebot_tests.py M tests/basesite_tests.py M tests/bot_tests.py M tests/cache_tests.py M tests/category_bot_tests.py M tests/category_tests.py M tests/checkimages_tests.py M tests/collections_tests.py M tests/cosmetic_changes_tests.py M tests/data_ingestion_tests.py M tests/datasite_tests.py M tests/date_tests.py M tests/deletionbot_tests.py M tests/diff_tests.py M tests/djvu_tests.py M tests/dry_api_tests.py M tests/dry_site_tests.py M tests/echo_tests.py M tests/edit_failure_tests.py M tests/edit_tests.py M tests/eventstreams_tests.py M tests/family_tests.py M tests/file_tests.py M tests/fixes_tests.py M tests/fixing_redirects_tests.py M tests/flow_edit_tests.py M tests/flow_tests.py M tests/flow_thanks_tests.py M tests/generate_family_file_tests.py M tests/generate_user_files_tests.py M tests/gui_tests.py M tests/harvest_template_tests.py M tests/http_tests.py M tests/i18n_tests.py M tests/interwiki_graph_tests.py M tests/interwiki_link_tests.py M tests/interwikidata_tests.py M tests/interwikimap_tests.py M tests/l10n_tests.py M tests/link_tests.py M tests/linter_tests.py M tests/logentries_tests.py M tests/login_tests.py M tests/make_dist_tests.py M tests/mediawikiversion_tests.py M tests/memento_tests.py M tests/mysql_tests.py M tests/namespace_tests.py M tests/noreferences_tests.py M tests/oauth_tests.py M tests/page_tests.py M tests/pagegenerators_tests.py M tests/paraminfo_tests.py M tests/patrolbot_tests.py M tests/plural_tests.py M tests/proofreadpage_tests.py M tests/protectbot_tests.py M tests/pwb_tests.py M tests/redirect_bot_tests.py M tests/reflinks_tests.py M tests/replacebot_tests.py M tests/script_tests.py M tests/setup_tests.py M tests/site_decorators_tests.py M tests/site_detect_tests.py M tests/site_generators_tests.py M tests/site_login_logout_tests.py M tests/site_obsoletesites_tests.py M tests/site_tests.py M tests/siteinfo_tests.py M tests/sparql_tests.py M tests/template_bot_tests.py M tests/tests_tests.py M tests/textlib_tests.py M tests/thanks_tests.py M tests/time_tests.py M tests/timestripper_tests.py M tests/titletranslate_tests.py M tests/token_tests.py M tests/tools_chars_tests.py M tests/tools_deprecate_tests.py M tests/tools_formatter_tests.py M tests/tools_tests.py M tests/tools_threading_tests.py M tests/ui_options_tests.py M tests/ui_tests.py M tests/upload_tests.py M tests/uploadbot_tests.py M tests/uploadscript_tests.py M tests/user_tests.py M tests/wikibase_edit_tests.py M tests/wikibase_tests.py M tests/wikiblame_tests.py M tests/wikistats_tests.py M tests/xmlreader_tests.py 102 files changed, 114 insertions(+), 104 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/.coveragerc b/.coveragerc index dd6f136..ad05b18 100644 --- a/.coveragerc +++ b/.coveragerc @@ -14,6 +14,7 @@ raise NotImplementedError raise unittest.SkipTest self.skipTest + if __name__ == '__main__': if .+PYWIKIBOT_TEST_\w+.+: if self.mw_version < .+: if TYPE_CHECKING: diff --git a/pywikibot/config.py b/pywikibot/config.py index c6e170a..7f12bcc 100644 --- a/pywikibot/config.py +++ b/pywikibot/config.py @@ -34,7 +34,7 @@ default. Editor detection functions were moved to :mod:`editor`. """ # -# (C) Pywikibot team, 2003-2023 +# (C) Pywikibot team, 2003-2024 # # Distributed under the terms of the MIT license. # @@ -1099,7 +1099,7 @@ # # When called as main program, list all configuration variables # -if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': from pprint import PrettyPrinter as _PrettyPrinter _pp = _PrettyPrinter() _all = True diff --git a/pywikibot/scripts/shell.py b/pywikibot/scripts/shell.py index 28c4abe..54520dc 100755 --- a/pywikibot/scripts/shell.py +++ b/pywikibot/scripts/shell.py @@ -16,7 +16,7 @@ .. versionchanged:: 7.0 moved to pywikibot.scripts """ -# (C) Pywikibot team, 2014-2023 +# (C) Pywikibot team, 2014-2024 # # Distributed under the terms of the MIT license. # @@ -57,7 +57,7 @@ exitmsg='Thank you for using Pywikibot; exiting now...\n')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': if sys.platform == 'win32': import platform import subprocess diff --git a/setup.py b/setup.py index 852b1fe..f09b8d5 100755 --- a/setup.py +++ b/setup.py @@ -139,7 +139,7 @@ return config['project']['name'].strip('"')
-def get_validated_version(name: str) -> str: +def get_validated_version(name: str) -> str: # pragma: no cover """Get a validated pywikibot module version string.
The version number from pywikibot.__metadata__.__version__ is used. @@ -255,5 +255,5 @@ )
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': main() diff --git a/tests/__init__.py b/tests/__init__.py index 7aaa681..c965467 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -333,6 +333,6 @@ pywikibot.data.api.CachedRequest._expired = original_expired
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/add_text_tests.py b/tests/add_text_tests.py index fec18cb..276c416 100755 --- a/tests/add_text_tests.py +++ b/tests/add_text_tests.py @@ -212,5 +212,5 @@ ], pywikibot.bot.ui.pop_output())
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/api_tests.py b/tests/api_tests.py index bfbcd09..83db11b 100755 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -961,6 +961,6 @@ self.assertEqual(float(lag['lag']), time)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/archivebot_tests.py b/tests/archivebot_tests.py index e2c8eae..20a6052 100755 --- a/tests/archivebot_tests.py +++ b/tests/archivebot_tests.py @@ -347,6 +347,6 @@ archivebot.PageArchiver(page, tmpl_without_ns, '')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/basesite_tests.py b/tests/basesite_tests.py index 29971bb..4b6e138 100755 --- a/tests/basesite_tests.py +++ b/tests/basesite_tests.py @@ -129,6 +129,6 @@ 'MediaWiki:always'))
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/bot_tests.py b/tests/bot_tests.py index e275ea4..ab8a5cc 100755 --- a/tests/bot_tests.py +++ b/tests/bot_tests.py @@ -319,6 +319,6 @@ self.assertNotIn('baz', oh.opt.__dict__)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/cache_tests.py b/tests/cache_tests.py index 6314da5..2d7ea8b 100755 --- a/tests/cache_tests.py +++ b/tests/cache_tests.py @@ -40,5 +40,5 @@ tests=25)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/category_bot_tests.py b/tests/category_bot_tests.py index e96cec3..0ce04ce 100755 --- a/tests/category_bot_tests.py +++ b/tests/category_bot_tests.py @@ -113,6 +113,6 @@ self.assertEqual(bot.includeonly, [])
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/category_tests.py b/tests/category_tests.py index ce8610b..9f0e7cd 100755 --- a/tests/category_tests.py +++ b/tests/category_tests.py @@ -282,6 +282,6 @@ self.assertEqual(count, cat.categoryinfo['size'])
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/checkimages_tests.py b/tests/checkimages_tests.py index 518c582..ff9cfa8 100755 --- a/tests/checkimages_tests.py +++ b/tests/checkimages_tests.py @@ -44,5 +44,5 @@ FilePage(self.site, 'Example.jpg'))
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/collections_tests.py b/tests/collections_tests.py index c20f811..4605dd7 100755 --- a/tests/collections_tests.py +++ b/tests/collections_tests.py @@ -256,6 +256,6 @@ self._test_new_empty()
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py index 215ba06..4cc48b3 100755 --- a/tests/cosmetic_changes_tests.py +++ b/tests/cosmetic_changes_tests.py @@ -625,6 +625,6 @@ self.cct.ignore = safe_ignore
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/data_ingestion_tests.py b/tests/data_ingestion_tests.py index 3b1bb00..6badedf 100755 --- a/tests/data_ingestion_tests.py +++ b/tests/data_ingestion_tests.py @@ -130,5 +130,5 @@ '-page:User:John_Vandenberg/data_ingestion_test_template')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/datasite_tests.py b/tests/datasite_tests.py index 69231b7..c337720 100755 --- a/tests/datasite_tests.py +++ b/tests/datasite_tests.py @@ -102,6 +102,6 @@ datasite.search_entities('abc', 'invalidlanguage')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/date_tests.py b/tests/date_tests.py index 3e5f58c..5437c5c 100755 --- a/tests/date_tests.py +++ b/tests/date_tests.py @@ -137,6 +137,6 @@ datetime(2013, 3, 31)), -12)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/deletionbot_tests.py b/tests/deletionbot_tests.py index 0b6382c..645d482 100755 --- a/tests/deletionbot_tests.py +++ b/tests/deletionbot_tests.py @@ -140,6 +140,6 @@ TestDeletionBot.undelete_args = [self.title(as_link=True), reason]
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/diff_tests.py b/tests/diff_tests.py index 70c0d06..5e7f049 100755 --- a/tests/diff_tests.py +++ b/tests/diff_tests.py @@ -277,6 +277,6 @@ mock.assert_any_call(self.none_message)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/djvu_tests.py b/tests/djvu_tests.py index 17bd8de..2031c10 100755 --- a/tests/djvu_tests.py +++ b/tests/djvu_tests.py @@ -126,6 +126,6 @@ dp.communicate()
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/dry_api_tests.py b/tests/dry_api_tests.py index 2870651..a948c95 100755 --- a/tests/dry_api_tests.py +++ b/tests/dry_api_tests.py @@ -447,5 +447,5 @@ q_gen1.request._params.items(), q_gen2.request._params.items())
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/dry_site_tests.py b/tests/dry_site_tests.py index a13602d..be33020 100755 --- a/tests/dry_site_tests.py +++ b/tests/dry_site_tests.py @@ -108,5 +108,5 @@ format_string='Foo ({script_comments})'))
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/echo_tests.py b/tests/echo_tests.py index 5d382fc..ad9508f 100755 --- a/tests/echo_tests.py +++ b/tests/echo_tests.py @@ -60,6 +60,6 @@ self.assertIsNone(notif.revid)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/edit_failure_tests.py b/tests/edit_failure_tests.py index c16fa02..960e4c8 100755 --- a/tests/edit_failure_tests.py +++ b/tests/edit_failure_tests.py @@ -220,6 +220,6 @@ item.addClaim(claim)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/edit_tests.py b/tests/edit_tests.py index 2ad3b3c..93e6cdb 100755 --- a/tests/edit_tests.py +++ b/tests/edit_tests.py @@ -212,6 +212,6 @@ self.assertTrue(p.text.endswith(ts))
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/eventstreams_tests.py b/tests/eventstreams_tests.py index e53472b..1573fbc 100755 --- a/tests/eventstreams_tests.py +++ b/tests/eventstreams_tests.py @@ -311,6 +311,6 @@ self.assertLength(list(self.es), limit)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/family_tests.py b/tests/family_tests.py index 1c8f227..5b58660 100755 --- a/tests/family_tests.py +++ b/tests/family_tests.py @@ -233,6 +233,6 @@ self.assertEqual(family.from_url(url), code)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/file_tests.py b/tests/file_tests.py index 9e6e929..40cc008 100755 --- a/tests/file_tests.py +++ b/tests/file_tests.py @@ -563,6 +563,6 @@ item.addClaim(new_claim)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/fixes_tests.py b/tests/fixes_tests.py index 1bfdc80..70a9884 100755 --- a/tests/fixes_tests.py +++ b/tests/fixes_tests.py @@ -46,6 +46,6 @@ self.assertIs(fixes.fixes, old_fixes)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/fixing_redirects_tests.py b/tests/fixing_redirects_tests.py index db397c5..a60b121 100755 --- a/tests/fixing_redirects_tests.py +++ b/tests/fixing_redirects_tests.py @@ -29,5 +29,5 @@ self.assertEqual(text, new_text)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/flow_edit_tests.py b/tests/flow_edit_tests.py index d1378a0..a080b4d 100755 --- a/tests/flow_edit_tests.py +++ b/tests/flow_edit_tests.py @@ -300,6 +300,6 @@ self.assertTrue(flow.is_moderated)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/flow_tests.py b/tests/flow_tests.py index 4056dab..0d21e3e 100755 --- a/tests/flow_tests.py +++ b/tests/flow_tests.py @@ -263,6 +263,6 @@ self.assertTrue(topic_hidden.is_moderated)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/flow_thanks_tests.py b/tests/flow_thanks_tests.py index 3f4b293..f280c0e 100755 --- a/tests/flow_thanks_tests.py +++ b/tests/flow_thanks_tests.py @@ -58,6 +58,6 @@ self.assertAPIError('invalidrecipient', None, my_reply.thank)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/generate_family_file_tests.py b/tests/generate_family_file_tests.py index dccc037..6058930 100755 --- a/tests/generate_family_file_tests.py +++ b/tests/generate_family_file_tests.py @@ -113,6 +113,6 @@ .format(site=site, lang=lang))
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/generate_user_files_tests.py b/tests/generate_user_files_tests.py index 7bf11cd..6e469ee 100755 --- a/tests/generate_user_files_tests.py +++ b/tests/generate_user_files_tests.py @@ -103,6 +103,6 @@ self.assertEqual(config_text, '')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/gui_tests.py b/tests/gui_tests.py index 4c6be62..53044fa 100755 --- a/tests/gui_tests.py +++ b/tests/gui_tests.py @@ -73,6 +73,6 @@ from pywikibot.userinterfaces.gui import EditBoxWindow, Tkdialog
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/harvest_template_tests.py b/tests/harvest_template_tests.py index 9f7de17..8462e0a 100755 --- a/tests/harvest_template_tests.py +++ b/tests/harvest_template_tests.py @@ -63,6 +63,6 @@ self.assertEqual(time, out)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/http_tests.py b/tests/http_tests.py index e3580c2..57a3bcd 100755 --- a/tests/http_tests.py +++ b/tests/http_tests.py @@ -583,6 +583,6 @@ self.assertEqual(r_data, r_body)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py index 8f5522b..7f4853a 100755 --- a/tests/i18n_tests.py +++ b/tests/i18n_tests.py @@ -460,6 +460,6 @@ str(min(result, 1)))
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/interwiki_graph_tests.py b/tests/interwiki_graph_tests.py index 02423dc..2381c5f 100755 --- a/tests/interwiki_graph_tests.py +++ b/tests/interwiki_graph_tests.py @@ -80,6 +80,6 @@ nodes[node][0]['attributes']['shape'], shape)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/interwiki_link_tests.py b/tests/interwiki_link_tests.py index bb73305..c0b30e8 100755 --- a/tests/interwiki_link_tests.py +++ b/tests/interwiki_link_tests.py @@ -87,6 +87,6 @@ link.parse()
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/interwikidata_tests.py b/tests/interwikidata_tests.py index ea66071..45ced29 100755 --- a/tests/interwikidata_tests.py +++ b/tests/interwikidata_tests.py @@ -102,6 +102,6 @@ site=self.wt)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/interwikimap_tests.py b/tests/interwikimap_tests.py index 0797eb0..e2d921d 100755 --- a/tests/interwikimap_tests.py +++ b/tests/interwikimap_tests.py @@ -154,6 +154,6 @@ self.iw_map[prefix]
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/l10n_tests.py b/tests/l10n_tests.py index 0fb0327..e3d7ef8 100755 --- a/tests/l10n_tests.py +++ b/tests/l10n_tests.py @@ -135,6 +135,6 @@ )
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/link_tests.py b/tests/link_tests.py index ad15a9e..b673c43 100755 --- a/tests/link_tests.py +++ b/tests/link_tests.py @@ -933,6 +933,6 @@ 'en', 'wikipedia')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/linter_tests.py b/tests/linter_tests.py index 602e24f..ceb52d7 100755 --- a/tests/linter_tests.py +++ b/tests/linter_tests.py @@ -36,6 +36,6 @@ ['obsolete-tag', 'missing-end-tag'])
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/logentries_tests.py b/tests/logentries_tests.py index b31f3d8..2e92474 100755 --- a/tests/logentries_tests.py +++ b/tests/logentries_tests.py @@ -294,6 +294,6 @@ self.assertEqual(type(le4), type(le5))
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/login_tests.py b/tests/login_tests.py index 311f800..f27d0e3 100755 --- a/tests/login_tests.py +++ b/tests/login_tests.py @@ -179,5 +179,5 @@ self.assertEqual(obj.login_name, '~FakeUsername@~FakeSuffix')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/make_dist_tests.py b/tests/make_dist_tests.py index 326f0b6..26d498f 100755 --- a/tests/make_dist_tests.py +++ b/tests/make_dist_tests.py @@ -37,5 +37,5 @@ self.assertTrue(upgrade)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/mediawikiversion_tests.py b/tests/mediawikiversion_tests.py index 8b9ffdb..f5c2f15 100755 --- a/tests/mediawikiversion_tests.py +++ b/tests/mediawikiversion_tests.py @@ -110,6 +110,6 @@ MediaWikiVersion.from_generator('Invalid 1.2.3')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/memento_tests.py b/tests/memento_tests.py index 329de2f..2a56d80 100755 --- a/tests/memento_tests.py +++ b/tests/memento_tests.py @@ -75,6 +75,6 @@ self._get_archive_url('invalid')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/mysql_tests.py b/tests/mysql_tests.py index 821d872..e97c708 100755 --- a/tests/mysql_tests.py +++ b/tests/mysql_tests.py @@ -29,6 +29,6 @@ self.assertEqual(next(result), 'test')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/namespace_tests.py b/tests/namespace_tests.py index 447575c..28f6cf9 100755 --- a/tests/namespace_tests.py +++ b/tests/namespace_tests.py @@ -381,6 +381,6 @@ namespaces['|']
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/noreferences_tests.py b/tests/noreferences_tests.py index 53513c5..d64d2d6 100755 --- a/tests/noreferences_tests.py +++ b/tests/noreferences_tests.py @@ -40,5 +40,5 @@ self.assertEqual(new_text, expected)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/oauth_tests.py b/tests/oauth_tests.py index f886526..345d4f3 100755 --- a/tests/oauth_tests.py +++ b/tests/oauth_tests.py @@ -74,6 +74,6 @@ self.site.username())
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/page_tests.py b/tests/page_tests.py index 1104935..b56cf4b 100755 --- a/tests/page_tests.py +++ b/tests/page_tests.py @@ -1262,6 +1262,6 @@ 'w.wiki/3Cz')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py index 34b4e19..ce38f4f 100755 --- a/tests/pagegenerators_tests.py +++ b/tests/pagegenerators_tests.py @@ -1771,6 +1771,6 @@ self.assertLength(list(gen), 1)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/paraminfo_tests.py b/tests/paraminfo_tests.py index f4218eb..fd5f183 100755 --- a/tests/paraminfo_tests.py +++ b/tests/paraminfo_tests.py @@ -245,5 +245,5 @@ self._check_param_values(self.repo, 'wbgetclaims', 'rank', known)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/patrolbot_tests.py b/tests/patrolbot_tests.py index 8d05b43..b957695 100755 --- a/tests/patrolbot_tests.py +++ b/tests/patrolbot_tests.py @@ -70,6 +70,6 @@ self.assertTrue(self.bot.in_list({'', 'Foo'}, 'Foo'))
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/plural_tests.py b/tests/plural_tests.py index 2c71287..a7b22f4 100755 --- a/tests/plural_tests.py +++ b/tests/plural_tests.py @@ -63,6 +63,6 @@ max_num = 1000
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/proofreadpage_tests.py b/tests/proofreadpage_tests.py index d547242..09a9677 100755 --- a/tests/proofreadpage_tests.py +++ b/tests/proofreadpage_tests.py @@ -1000,6 +1000,6 @@ self.assertFalse(self.index.has_valid_content())
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/protectbot_tests.py b/tests/protectbot_tests.py index 372cbf0..4688512 100755 --- a/tests/protectbot_tests.py +++ b/tests/protectbot_tests.py @@ -60,6 +60,6 @@ 'administrators] (indefinite))')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/pwb_tests.py b/tests/pwb_tests.py index 3684ae9..6cd561b 100755 --- a/tests/pwb_tests.py +++ b/tests/pwb_tests.py @@ -141,5 +141,5 @@ self.assertLength(remaining, 3) # always 3 lines remaining after list
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main(verbosity=10) diff --git a/tests/redirect_bot_tests.py b/tests/redirect_bot_tests.py index c3e225c..94e140e 100755 --- a/tests/redirect_bot_tests.py +++ b/tests/redirect_bot_tests.py @@ -68,6 +68,6 @@ w.assert_called_with('No speedy deletion template "n" available.')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/reflinks_tests.py b/tests/reflinks_tests.py index 633d828..ed87e5e 100755 --- a/tests/reflinks_tests.py +++ b/tests/reflinks_tests.py @@ -174,5 +174,5 @@ TestReferencesBotConstructor.constructor_kwargs = kwargs
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/replacebot_tests.py b/tests/replacebot_tests.py index 98e42b7..2237ba5 100755 --- a/tests/replacebot_tests.py +++ b/tests/replacebot_tests.py @@ -304,6 +304,6 @@ ], pywikibot.bot.ui.pop_output())
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/script_tests.py b/tests/script_tests.py index d59eb01..ce38ef8 100755 --- a/tests/script_tests.py +++ b/tests/script_tests.py @@ -454,6 +454,6 @@ _timeout = True
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/setup_tests.py b/tests/setup_tests.py index ddc9040..b2cbe24 100644 --- a/tests/setup_tests.py +++ b/tests/setup_tests.py @@ -64,5 +64,5 @@ self.assertIn(name + '.userscripts', packages)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/site_decorators_tests.py b/tests/site_decorators_tests.py index f6e56ca..a1e3c71 100755 --- a/tests/site_decorators_tests.py +++ b/tests/site_decorators_tests.py @@ -283,5 +283,5 @@ __name__ + '.TestNeedVersion.deprecated_available_method2')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/site_detect_tests.py b/tests/site_detect_tests.py index 0f703ff..c834bb3 100755 --- a/tests/site_detect_tests.py +++ b/tests/site_detect_tests.py @@ -239,6 +239,6 @@ self.assertEqual(site.lang, self.LANG)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py index 2172160..4109cbc 100755 --- a/tests/site_generators_tests.py +++ b/tests/site_generators_tests.py @@ -2287,6 +2287,6 @@ self.assertTrue(page.has_content())
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/site_login_logout_tests.py b/tests/site_login_logout_tests.py index a095711..18e0072 100755 --- a/tests/site_login_logout_tests.py +++ b/tests/site_login_logout_tests.py @@ -87,6 +87,6 @@ raise unittest.SkipTest('login/logout tests are disabled')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/site_obsoletesites_tests.py b/tests/site_obsoletesites_tests.py index 885ba4c..00cb092 100755 --- a/tests/site_obsoletesites_tests.py +++ b/tests/site_obsoletesites_tests.py @@ -59,6 +59,6 @@ self.assertEqual(site.ssl_hostname(), 'ja.wikipedia.org')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/site_tests.py b/tests/site_tests.py index 5ba71e4..9014d0e 100755 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -1320,6 +1320,6 @@ self.assertIsNone(page)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/siteinfo_tests.py b/tests/siteinfo_tests.py index 16ea8f5..cc8b8e8 100755 --- a/tests/siteinfo_tests.py +++ b/tests/siteinfo_tests.py @@ -127,6 +127,6 @@ self.assertTrue(self.site.siteinfo.is_cached('statistics'))
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/sparql_tests.py b/tests/sparql_tests.py index 99e0bb0..2b65988 100755 --- a/tests/sparql_tests.py +++ b/tests/sparql_tests.py @@ -254,6 +254,6 @@ {'value': 'http://foo.com%27%7D, 'http://bar.com')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/template_bot_tests.py b/tests/template_bot_tests.py index 34c5fc0..d949007 100755 --- a/tests/template_bot_tests.py +++ b/tests/template_bot_tests.py @@ -101,5 +101,5 @@ site=self.site)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/tests_tests.py b/tests/tests_tests.py index a007a40..c426a70 100755 --- a/tests/tests_tests.py +++ b/tests/tests_tests.py @@ -96,6 +96,6 @@ self.assertFalse(utils.entered_loop(''))
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py index c6c158f..5acd756 100755 --- a/tests/textlib_tests.py +++ b/tests/textlib_tests.py @@ -1688,6 +1688,6 @@ )
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/thanks_tests.py b/tests/thanks_tests.py index 4f2c05c..04b6fc9 100755 --- a/tests/thanks_tests.py +++ b/tests/thanks_tests.py @@ -113,6 +113,6 @@ source='pywikibot test')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/time_tests.py b/tests/time_tests.py index 57b8e0a..696f15a 100755 --- a/tests/time_tests.py +++ b/tests/time_tests.py @@ -292,6 +292,6 @@ parse_duration(invalid_value)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/timestripper_tests.py b/tests/timestripper_tests.py index 00d9cf1..2b768f1 100755 --- a/tests/timestripper_tests.py +++ b/tests/timestripper_tests.py @@ -438,6 +438,6 @@ self.assertEqual(ts.timestripper(txt_match), res)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/titletranslate_tests.py b/tests/titletranslate_tests.py index faaaf8d..c595769 100755 --- a/tests/titletranslate_tests.py +++ b/tests/titletranslate_tests.py @@ -40,5 +40,5 @@ self.assertLength(result, 6)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': unittest.main() diff --git a/tests/token_tests.py b/tests/token_tests.py index ac2b0f1..b86d005 100755 --- a/tests/token_tests.py +++ b/tests/token_tests.py @@ -132,6 +132,6 @@ self.assertTrue(raised, msg='pywikibot.exceptions.Error not raised')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/tools_chars_tests.py b/tests/tools_chars_tests.py index 6e25dff..7c12b15 100755 --- a/tests/tools_chars_tests.py +++ b/tests/tools_chars_tests.py @@ -43,6 +43,6 @@ self.assertIsEmpty(invalid.items())
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/tools_deprecate_tests.py b/tests/tools_deprecate_tests.py index f45a82e..930e328 100755 --- a/tests/tools_deprecate_tests.py +++ b/tests/tools_deprecate_tests.py @@ -807,6 +807,6 @@ + '.DeprecatedMethodClass.deprecated_instance_method_and_arg2')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/tools_formatter_tests.py b/tests/tools_formatter_tests.py index 5c8cc61..4812750 100755 --- a/tests/tools_formatter_tests.py +++ b/tests/tools_formatter_tests.py @@ -106,6 +106,6 @@ self.assert_format('{color}', '42', color=42)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/tools_tests.py b/tests/tools_tests.py index bc9d6e8..bfcc5e5 100755 --- a/tests/tools_tests.py +++ b/tests/tools_tests.py @@ -1076,6 +1076,6 @@ self.assertEqual(self.foo.read, 2)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/tools_threading_tests.py b/tests/tools_threading_tests.py index ab19eb4..4808895 100755 --- a/tests/tools_threading_tests.py +++ b/tests/tools_threading_tests.py @@ -41,6 +41,6 @@ self.assertEqual(list(thd_gen), list(iterable))
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/ui_options_tests.py b/tests/ui_options_tests.py index ac1a0ee..d9f2f07 100755 --- a/tests/ui_options_tests.py +++ b/tests/ui_options_tests.py @@ -212,6 +212,6 @@ raise QuitKeyboardInterrupt
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/ui_tests.py b/tests/ui_tests.py index 950dffb..d688b0c 100755 --- a/tests/ui_tests.py +++ b/tests/ui_tests.py @@ -519,6 +519,6 @@ expect_color = False
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/upload_tests.py b/tests/upload_tests.py index 99386ee..0cb1464 100755 --- a/tests/upload_tests.py +++ b/tests/upload_tests.py @@ -152,6 +152,6 @@ self._verify_stash()
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/uploadbot_tests.py b/tests/uploadbot_tests.py index a1fe0ca..4bc255f 100755 --- a/tests/uploadbot_tests.py +++ b/tests/uploadbot_tests.py @@ -85,6 +85,6 @@ self.assertFalse(bot.abort_on_warn('any warning')) # aborts
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/uploadscript_tests.py b/tests/uploadscript_tests.py index 046bc0d..26d6e63 100755 --- a/tests/uploadscript_tests.py +++ b/tests/uploadscript_tests.py @@ -44,6 +44,6 @@ self.assertEqual(match('3mike'), 0)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/user_tests.py b/tests/user_tests.py index a46d88d..de30fcd 100755 --- a/tests/user_tests.py +++ b/tests/user_tests.py @@ -212,6 +212,6 @@ self.assertEqual(event.user(), user.username)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/wikibase_edit_tests.py b/tests/wikibase_edit_tests.py index a80eda8..307c4f5 100755 --- a/tests/wikibase_edit_tests.py +++ b/tests/wikibase_edit_tests.py @@ -628,6 +628,6 @@ self.assertEqual(claim1.getTarget(), target1)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py index 8390755..cea1677 100755 --- a/tests/wikibase_tests.py +++ b/tests/wikibase_tests.py @@ -2528,6 +2528,6 @@ self.assertEqual(diff, expected)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/wikiblame_tests.py b/tests/wikiblame_tests.py index 1d6d16a..3789b6a 100644 --- a/tests/wikiblame_tests.py +++ b/tests/wikiblame_tests.py @@ -31,6 +31,6 @@ self.assertGreater(value, 0)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/wikistats_tests.py b/tests/wikistats_tests.py index 5a3931b..762de32 100755 --- a/tests/wikistats_tests.py +++ b/tests/wikistats_tests.py @@ -108,6 +108,6 @@ self.assertIn('total', data)
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main() diff --git a/tests/xmlreader_tests.py b/tests/xmlreader_tests.py index 0398ad1..758d921 100755 --- a/tests/xmlreader_tests.py +++ b/tests/xmlreader_tests.py @@ -153,6 +153,6 @@ 'moved [[Çullu, Agdam]] to [[Çullu, Quzanlı]]: dab')
-if __name__ == '__main__': # pragma: no cover +if __name__ == '__main__': with suppress(SystemExit): unittest.main()
pywikibot-commits@lists.wikimedia.org