Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/812447 )
Change subject: [tests] Ignore OSError and ServerErrors from coverage by default ......................................................................
[tests] Ignore OSError and ServerErrors from coverage by default
Change-Id: I63f6d059181ab000e9f9c2e62852879d2739ca5f --- M .coveragerc M pywikibot/scripts/generate_family_file.py M scripts/interwiki.py 3 files changed, 4 insertions(+), 2 deletions(-)
Approvals: Xqt: Verified; Looks good to me, approved
diff --git a/.coveragerc b/.coveragerc index 7a11b16..e7214d5 100644 --- a/.coveragerc +++ b/.coveragerc @@ -7,7 +7,9 @@ pragma: no cover except ImportError except KeyboardInterrupt + except OSError except pkg_resources + except \w*ServerError except SyntaxError raise NotImplementedError raise unittest.SkipTest diff --git a/pywikibot/scripts/generate_family_file.py b/pywikibot/scripts/generate_family_file.py index 47c4b8b..e545c89 100755 --- a/pywikibot/scripts/generate_family_file.py +++ b/pywikibot/scripts/generate_family_file.py @@ -118,7 +118,7 @@ for verify in (True, False): try: w = self.Wiki(self.base_url, verify=verify) - except FatalServerError: # pragma: no cover + except FatalServerError: pywikibot.error( pywikibot.comms.http.SSL_CERT_VERIFY_FAILED_MSG) pywikibot.exception() diff --git a/scripts/interwiki.py b/scripts/interwiki.py index c353b17..0510d2f 100755 --- a/scripts/interwiki.py +++ b/scripts/interwiki.py @@ -2398,7 +2398,7 @@ bot.run() except KeyboardInterrupt: dump.write_dump(bot.dump_titles, append) - except Exception: + except Exception: # pragma: no cover pywikibot.exception() dump.write_dump(bot.dump_titles, append) else:
pywikibot-commits@lists.wikimedia.org