jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1181139?usp=email )
Change subject: Tests: No longer import script within script_tests ...................................................................... Tests: No longer import script within script_tests Scripts are already covers by subprocess. Also update coverage settings Change-Id: Ic910d7a85d8c142000707a5d855a169e62f25f84 --- M pyproject.toml M tests/script_tests.py 2 files changed, 5 insertions(+), 15 deletions(-) Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved diff --git a/pyproject.toml b/pyproject.toml index ad901e9..bbca9ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -136,7 +136,7 @@ "@deprecated\\([^\\)]+\\)", "@unittest\\.skip", "class .+\\bProtocol\\):", - "except ImportError", + "except (ImportError|ModuleNotFoundError)", "except KeyboardInterrupt", "except OSError", "except SyntaxError", @@ -149,12 +149,15 @@ "if self\\.mw_version < .+:", # Comments to turn coverage on and off: "no cover: start(?s:.)*?no cover: stop", - "raise ImportError", + "raise (ImportError|ModuleNotFoundError)", "raise NotImplementedError", "raise unittest\\.SkipTest", "self\\.skipTest", ] +[tool.coverage.run] +concurrency = "multiprocessing" +parallel = true [tool.docsig] disable = [ diff --git a/tests/script_tests.py b/tests/script_tests.py index 77567a3..4ff8fd2 100755 --- a/tests/script_tests.py +++ b/tests/script_tests.py @@ -11,7 +11,6 @@ import sys import unittest from contextlib import suppress -from importlib import import_module from pathlib import Path from pywikibot.tools import has_module @@ -183,17 +182,6 @@ return collector(loader) -def import_script(script_name: str) -> None: - """Import script for coverage only (T305795).""" - if not ci_test_run: - return # pragma: no cover - - prefix = 'scripts.' - if script_name in framework_scripts: - prefix = 'pywikibot.' + prefix - import_module(prefix + script_name) - - class ScriptTestMeta(MetaTestCaseClass): """Test meta class.""" @@ -300,7 +288,6 @@ arguments = dct['_arguments'] for script_name in script_list: - import_script(script_name) # force login to be the first, alphabetically, so the login # message does not unexpectedly occur during execution of -- To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1181139?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: Ic910d7a85d8c142000707a5d855a169e62f25f84 Gerrit-Change-Number: 1181139 Gerrit-PatchSet: 1 Gerrit-Owner: Xqt <i...@gno.de> Gerrit-Reviewer: Xqt <i...@gno.de> Gerrit-Reviewer: jenkins-bot
_______________________________________________ Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org