jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676852 )
Change subject: [tests] Skip when watchlist rights are unavailable
......................................................................
[tests] Skip when watchlist rights are unavailable
Bug: T279286
Change-Id: I6dc140afcc755ff83b21e73877dbbd27d1b16547
---
M tests/page_tests.py
M tests/site_tests.py
2 files changed, 16 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/page_tests.py b/tests/page_tests.py
index f6ce4f8..7c1d476 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -1020,6 +1020,10 @@
def test_watch(self):
"""Test Page.watch, with and without unwatch enabled."""
+ if not self.site.has_right('editmywatchlist'):
+ self.skipTest('user {} cannot edit its watch list'
+ .format(self.site.user()))
+
# Note: this test uses the userpage, so that it is unwatched and
# therefore is not listed by script_tests test_watchlist_simulate.
userpage = self.get_userpage()
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 0e125b5..0b01ded 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -1402,6 +1402,10 @@
def test_watched_pages(self):
"""Test the site.watched_pages() method."""
+ if not self.site.has_right('viewmywatchlist'):
+ self.skipTest('user {} cannot view its watch list'
+ .format(self.site.user()))
+
gen = self.site.watched_pages(total=5, force=False)
self.assertIsInstance(gen.request, api.CachedRequest)
for page in gen:
@@ -1414,6 +1418,10 @@
def test_watched_pages_uncached(self):
"""Test the site.watched_pages() method uncached."""
+ if not self.site.has_right('viewmywatchlist'):
+ self.skipTest('user {} cannot view its watch list'
+ .format(self.site.user()))
+
gen = self.site.watched_pages(total=5, force=True)
self.assertIsInstance(gen.request, api.Request)
self.assertFalse(issubclass(gen.request_class, api.CachedRequest))
@@ -1806,6 +1814,10 @@
def test_watchlist_revs(self):
"""Test the site.watchlist_revs() method."""
+ if not self.site.has_right('viewmywatchlist'):
+ self.skipTest('user {} cannot view its watch list'
+ .format(self.site.user()))
+
mysite = self.get_site()
wl = list(mysite.watchlist_revs(total=10))
self.assertLessEqual(len(wl), 10)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676852
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I6dc140afcc755ff83b21e73877dbbd27d1b16547
Gerrit-Change-Number: 676852
Gerrit-PatchSet: 6
Gerrit-Owner: Damian <atagar1(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676934 )
Change subject: [sphinx] Improvements for docs/conf.py
......................................................................
[sphinx] Improvements for docs/conf.py
- highlight the first line of a script
Change-Id: I397f5702b62a0edd292443b59b651ab10fc13083
---
M docs/conf.py
1 file changed, 3 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index 7b28b2d..c041d9d 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -417,7 +417,9 @@
length = 0
for index, line in enumerate(lines):
- if line == '¶ms;':
+ if index == 0: # highlight the first line
+ lines[0] = '**{}**'.format(line.strip('.'))
+ elif line == '¶ms;':
lines[index] = ('This script supports use of '
':py:mod:`pywikibot.pagegenerators` arguments.')
elif name == 'scripts.replace' and line == '&fixes-help;':
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676934
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I397f5702b62a0edd292443b59b651ab10fc13083
Gerrit-Change-Number: 676934
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676866 )
Change subject: [tests] Add commons_information to script_tests.script_deps
......................................................................
[tests] Add commons_information to script_tests.script_deps
Change-Id: I8c7826626d9ccaa0503086d2e513a948c4c1192b
---
M tests/script_tests.py
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/tests/script_tests.py b/tests/script_tests.py
index c2a6dd7..4e7cb11 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -22,6 +22,7 @@
# These dependencies are not always the package name which is in setup.py.
# Here, the name given to the module which will be imported is required.
script_deps = {
+ 'commons_information': ['mwparserfromhell'],
'patrol': ['mwparserfromhell'],
'weblinkchecker': ['memento_client'],
}
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676866
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I8c7826626d9ccaa0503086d2e513a948c4c1192b
Gerrit-Change-Number: 676866
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676811 )
Change subject: [sphinx] Fix docstrings in archivebot.py
......................................................................
[sphinx] Fix docstrings in archivebot.py
Change-Id: Ifd57ed14ef52f641064e207ddd939f04b2a9b4fe
---
M scripts/archivebot.py
1 file changed, 20 insertions(+), 17 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index a48673b..8c947d6 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -222,12 +222,16 @@
"""
Return the key and duration extracted from the string.
- @param string: a string defining a time period:
+ @param string: a string defining a time period
+
+ Examples::
+
300s - 300 seconds
36h - 36 hours
7d - 7 days
2w - 2 weeks (14 days)
1y - 1 year
+
@return: key and duration extracted form the string
"""
if string.isdigit():
@@ -246,12 +250,13 @@
"""
Return a size for a shorthand size.
- Accepts a string defining a size:
- 1337 - 1337 bytes
- 150K - 150 kilobytes
- 2M - 2 megabytes
- Returns a tuple (size,unit), where size is an integer and unit is
- 'B' (bytes) or 'T' (threads).
+ Accepts a string defining a size::
+ 1337 - 1337 bytes
+ 150K - 150 kilobytes
+ 2M - 2 megabytes
+
+ @Returns: a tuple ``(size, unit)``, where C{size} is an integer and
+ unit is C{'B'} (bytes) or C{'T'} (threads).
"""
match = re.fullmatch(r'(\d{1,3}(?: \d{3})+|\d+) *([BkKMT]?)', string)
if not match:
@@ -326,7 +331,7 @@
"""
An object representing a discussion thread on a page.
- It represents something that is of the form:
+ It represents something that is of the form::
== Title of thread ==
@@ -500,17 +505,15 @@
algo = 'none'
- def __init__(self, page, template, salt, force=False) -> None:
+ def __init__(self, page, template, salt: str, force: bool = False) -> None:
"""Initializer.
- param page: a page object to be archived
- type page: pywikibot.Page
- param template: a template with configuration settings
- type template: pywikibot.Page
- param salt: salt value
- type salt: str
- param force: override security value
- type force: bool
+ @param page: a page object to be archived
+ @type page: L{pywikibot.Page}
+ @param template: a template with configuration settings
+ @type template: L{pywikibot.Page}
+ @param salt: salt value
+ @param force: override security value
"""
self.attributes = OrderedDict([
('archive', ['', False]),
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676811
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ifd57ed14ef52f641064e207ddd939f04b2a9b4fe
Gerrit-Change-Number: 676811
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged