jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1170652?usp=email )
Change subject: Doc: Fix typo and clarify docstring in aspects.require_version()
......................................................................
Doc: Fix typo and clarify docstring in aspects.require_version()
Change-Id: Ib2d9eeaf90535cae8306e0383eb45896abdb137d
---
M tests/aspects.py
1 file changed, 10 insertions(+), 8 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/aspects.py b/tests/aspects.py
index c80b2cb..41f6e6e 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -443,16 +443,16 @@
def require_version(version_needed: str, /, reason: str = ''):
- """Require minimum MediaWiki version to be queried.
+ """Skip test unless a minimum MediaWiki version is available.
- The version needed for the test; must be given with a preleading rich
- comparisons operator like ``<1.31wmf4`` or ``>=1.43``. If the
- comparison does not match the test will be skipped.
+ The required version must include a comparison operator (e.g.
+ :code:`<1.31wmf4` or :code:`>=1.43`). If the site's version does not
+ satisfy the condition, the test is skipped.
- This decorator can only be used for TestCase having a single site.
- It cannot be used for DrySite tests. In addition version comparison
- for other than the current site e.g. for the related data or image
- repositoy of the current site is ot possible.
+ This decorator can only be used for :class:`TestCase` having a
+ single site. It cannot be used for DrySite tests. Version checks are
+ only supported for the current site — not for related sites like
+ data or image repositories.
.. versionadded:: 8.0
@@ -486,6 +486,8 @@
)
try:
+ # Split version string into operator and version
+ # (e.g. '>=1.39' → '', '>=', '1.39')
site_vers, op, version = re.split('([<>]=?)', version_needed)
except ValueError:
raise ValueError(f'There is no valid operator given with '
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1170652?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: Ib2d9eeaf90535cae8306e0383eb45896abdb137d
Gerrit-Change-Number: 1170652
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]