jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1055471?usp=email )
Change subject: [IMPR] remove -wiktionary option from interwiki.py script
......................................................................
[IMPR] remove -wiktionary option from interwiki.py script
wiktionary is supported by wikidata. There is no reason to keep this
option any longer.
Change-Id: Ibf9de85b4e3aa96055ad02adc0f0abad75b8325c
---
M scripts/interwiki.py
1 file changed, 18 insertions(+), 38 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 4592eb9..81a8359 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
-"""
-Script to check language links for general pages.
+"""Script to check language links for general pages.
Uses existing translations of a page, plus hints from the command line, to
download the equivalent pages from other languages. All of such pages are
@@ -110,9 +109,8 @@
hints, the bot does nothing.
Hitting return without input on the "Which page to check:"
prompt has the same effect as using -hintsonly.
- Options like -back, -same or -wiktionary are in effect only
- after a page has been found to work on.
- (note: without ending colon)
+ Options like -back or -same are in effect only after a page
+ has been found to work on. (note: without ending colon)
These arguments are useful to provide hints to the bot:
@@ -163,11 +161,6 @@
-same is equivalent to -hint:all:
(note: without ending colon)
- -wiktionary: similar to -same, but will ONLY accept names that are
- identical to the original. Also, if the title is not
- capitalized, it will only go through other wikis without
- automatic capitalization.
-
-untranslated: works normally on pages with at least one interlanguage
link; asks for hints for pages that have none.
@@ -352,7 +345,12 @@
titletranslate,
)
from pywikibot.backports import Iterable
-from pywikibot.bot import ListOption, OptionHandler, StandardOption
+from pywikibot.bot import (
+ ListOption,
+ OptionHandler,
+ StandardOption,
+ suggest_help,
+)
from pywikibot.cosmetic_changes import moved_links
from pywikibot.exceptions import (
EditConflictError,
@@ -489,11 +487,6 @@
R = re.compile(r'\[\[(.+?)(?:\]\]|\|)')
with codecs.open(hintfilename, 'r', config.textfile_encoding) as f:
self.hints += R.findall(f.read())
- elif arg == 'wiktionary':
- self.same = 'wiktionary'
- # Don't use auto-translation in -wiktionary mode
- # where page titles must be the same
- self.auto = False
elif arg == 'untranslatedonly':
self.untranslated = True
self.untranslatedonly = True
@@ -818,8 +811,7 @@
def skipPage(self, page, target, counter):
"""Return whether page has to be skipped."""
return self.isIgnored(target) \
- or self.namespaceMismatch(page, target, counter) \
- or self.wiktionaryMismatch(target)
+ or self.namespaceMismatch(page, target, counter)
@staticmethod
def get_alternative(
@@ -903,24 +895,6 @@
# or no origin page yet, also no problem
return False
- def wiktionaryMismatch(self, page) -> bool:
- """Check for ignoring pages."""
- if self.origin and self.conf.same == 'wiktionary':
- if page.title().lower() != self.origin.title().lower():
- pywikibot.info(f'NOTE: Ignoring {page} for {self.origin} in '
- f'wiktionary mode')
- return True
-
- if (page.title() != self.origin.title()
- and self.origin.namespace().case == 'case-sensitive'
- and page.namespace().case == 'case-sensitive'):
- pywikibot.info(
- f'NOTE: Ignoring {page} for {self.origin} in wiktionary'
- ' mode because both languages are uncapitalized.')
- return True
-
- return False
-
def disambigMismatch(self, page, counter):
"""
Check whether the given page has a different disambiguation status.
@@ -2287,6 +2261,7 @@
optRestore = False
append = True
newPages = None
+ unknown = []
# Process global args and prepare generator args parser
local_args = pywikibot.handle_args(args)
@@ -2338,9 +2313,14 @@
number = int(arg[8:])
elif arg.startswith('-until:'):
until = arg[7:]
- else:
- if not genFactory.handle_arg(arg) and not singlePageTitle:
+ elif not genFactory.handle_arg(arg):
+ if not (arg.startswith('-') or singlePageTitle):
singlePageTitle = arg
+ else:
+ unknown.append(arg)
+
+ if suggest_help(unknown_parameters=unknown):
+ return
# Do not use additional summary with autonomous mode
if iwconf.autonomous:
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1055471?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: Ibf9de85b4e3aa96055ad02adc0f0abad75b8325c
Gerrit-Change-Number: 1055471
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1056923?usp=email )
Change subject: Localisation updates from https://translatewiki.net.
......................................................................
Localisation updates from https://translatewiki.net.
Change-Id: I95f0b395085d550a5ca480d8398a0eaffcf880d3
---
M redirect/fr.json
M redirect/he.json
M redirect/qqq.json
M redirect/sr.json
4 files changed, 14 insertions(+), 12 deletions(-)
Approvals:
jenkins-bot: Verified
L10n-bot: Looks good to me, approved
diff --git a/redirect/fr.json b/redirect/fr.json
index 475fdeb..5958c90 100644
--- a/redirect/fr.json
+++ b/redirect/fr.json
@@ -1,6 +1,7 @@
{
"@metadata": {
"authors": [
+ "Assorted-Interests",
"Boniface",
"Crochet.david",
"Gomoko",
@@ -14,9 +15,9 @@
]
},
"redirect-broken-redirect-template": "{{Suppression Immédiate|1=G8}}",
- "redirect-fix-broken-moved": "Correction des redirections erronées vers la page déplacée cible %(to)s",
- "redirect-fix-double": "Correction d’une double redirection vers %(to)s",
- "redirect-fix-loop": "Correction d’une boucle de redirection sur %(to)s",
+ "redirect-fix-broken-moved": "Correction des redirections erronées depuis %(from)s vers la page déplacée cible %(to)s",
+ "redirect-fix-double": "Correction d’une double redirection depuis %(from)s vers %(to)s",
+ "redirect-fix-loop": "Correction d’une boucle de redirection depuis %(from)s sur %(to)s",
"redirect-remove-broken": "Redirection vers une page supprimée ou inexistante",
"redirect-remove-loop": "La cible de la redirection génère une boucle de redirection"
}
diff --git a/redirect/he.json b/redirect/he.json
index de47e62..c026f6b 100644
--- a/redirect/he.json
+++ b/redirect/he.json
@@ -7,9 +7,9 @@
"ערן"
]
},
- "redirect-fix-broken-moved": "תיקון הפניה שבורה לדף היעד %(to)s, שהועבר",
- "redirect-fix-double": "מתקן הפניה כפולה לקישור %(to)s",
- "redirect-fix-loop": "תיקון הפניה מעגלית לקישור %(to)s",
+ "redirect-fix-broken-moved": "תיקון הפניה שבורה מהקישור %(from)s לדף היעד המועבר %(to)s",
+ "redirect-fix-double": "מתקן הפניה כפולה מהקישור %(from)s לקישור %(to)s",
+ "redirect-fix-loop": "תיקון הפניה מעגלית מהקישור %(from)s לקישור %(to)s",
"redirect-remove-broken": "יעד ההפניה נמחק או שאינו קיים",
"redirect-remove-loop": "ההפניה הזאת גורמת ללולאה אין־סופית של הפניות"
}
diff --git a/redirect/qqq.json b/redirect/qqq.json
index 4ced5b2..7797fc1 100644
--- a/redirect/qqq.json
+++ b/redirect/qqq.json
@@ -1,6 +1,7 @@
{
"@metadata": {
"authors": [
+ "Amire80",
"Csisc",
"Lloffiwr",
"Nemo bis",
@@ -9,9 +10,9 @@
]
},
"redirect-broken-redirect-template": "{{doc-important|Only use your deletion template like <code><nowiki>{{delete}}</nowiki></code> which exist on your local project.}}\n\nNOTE TO TRANSLATOR: This should only be translated by someone on the Wikipedia of your language code. Thank you.\n\nTemplate for speedy deletion of broken redirect or redirect loops which the bot tags onto the redirect page. This message may contain additional informations like template parameters or reasons for the deletion request.\n\nNOTE: If this system message is not given for a language code, speedy deletion request by a bot is not supported on your site except there is a bot with sysop flag.",
- "redirect-fix-broken-moved": "Edit summary when the bot fixes a broken redirect to a moved page whose origin has been deleted.\nParameters:\n* <code>%(from)s: the old redirect target\n* <code>%(to)s</code>: the new redirect target, as a wiki link.",
- "redirect-fix-double": "Edit summary when the bot fixes double redirects.\nParameters:\n* <code>%(from)s: the old redirect target as wiki link\n* <code>%(to)s</code> displays the new redirect target as a wiki link.",
- "redirect-fix-loop": "Edit summary when the bot fixes redirect loops.\nParameters:\n* <code>%(from)s: the old redirect target as wiki link\n* <code>%(to)s</code> displays the new redirect target as a wiki link.",
+ "redirect-fix-broken-moved": "Edit summary when the bot fixes a broken redirect to a moved page whose origin has been deleted.\nParameters:\n* <code>%(from)s</code>: the old redirect target\n* <code>%(to)s</code>: the new redirect target, as a wiki link.",
+ "redirect-fix-double": "Edit summary when the bot fixes double redirects.\nParameters:\n* <code>%(from)s</code>: the old redirect target as wiki link\n* <code>%(to)s</code> displays the new redirect target as a wiki link.",
+ "redirect-fix-loop": "Edit summary when the bot fixes redirect loops.\nParameters:\n* <code>%(from)s</code>: the old redirect target as wiki link\n* <code>%(to)s</code> displays the new redirect target as a wiki link.",
"redirect-remove-broken": "Edit summary when the bot tags a deleted or non-existent page for speedy deletion.",
"redirect-remove-loop": "Edit summary when the bot tags a redirect loop for speedy deletion."
}
diff --git a/redirect/sr.json b/redirect/sr.json
index a94219c..ac54ba5 100644
--- a/redirect/sr.json
+++ b/redirect/sr.json
@@ -9,9 +9,9 @@
]
},
"redirect-broken-redirect-template": "{{Брзо брисање|[[ВП:КББ|П1]]}}",
- "redirect-fix-broken-moved": "исправљено неисправно преусмерење до премештене циљне странице %(to)s",
- "redirect-fix-double": "исправљена двострука преусмерења у %(to)s.",
- "redirect-fix-loop": "исправљена петља преусмерења на %(to)s.",
+ "redirect-fix-broken-moved": "исправљено неисправно преусмерење из %(from)s до премештене одредишне странице %(to)s.",
+ "redirect-fix-double": "исправљено двоструко преусмерење из %(from)s у %(to)s.",
+ "redirect-fix-loop": "исправљена петља преусмерења из %(from)s у %(to)s.",
"redirect-remove-broken": "преусмерено на избрисану или непостојећу страницу.",
"redirect-remove-loop": "одредиште преусмерења образује петљу."
}
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1056923?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/i18n
Gerrit-Branch: master
Gerrit-Change-Id: I95f0b395085d550a5ca480d8398a0eaffcf880d3
Gerrit-Change-Number: 1056923
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot <l10n-bot(a)translatewiki.net>
Gerrit-Reviewer: L10n-bot <l10n-bot(a)translatewiki.net>
Gerrit-Reviewer: jenkins-bot
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1054503?usp=email )
Change subject: [fix] Ignore extension check in delinker.py scripts/delinker.py
......................................................................
[fix] Ignore extension check in delinker.py scripts/delinker.py
- add ignore_extension parameter to FilePage initializer to instantiate
a FilePage object without file extensions check
Bug: T352237
Change-Id: Ic7fe1750113047654c5660ff2de245a0a37279da
---
M pywikibot/page/_filepage.py
M scripts/delinker.py
2 files changed, 16 insertions(+), 9 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
diff --git a/pywikibot/page/_filepage.py b/pywikibot/page/_filepage.py
index eaed3dd..d91c181 100644
--- a/pywikibot/page/_filepage.py
+++ b/pywikibot/page/_filepage.py
@@ -38,25 +38,33 @@
Supports the same interface as Page except *ns*; some added methods.
"""
- def __init__(self, source, title: str = '') -> None:
+ def __init__(self, source, title: str = '', *,
+ ignore_extension: bool = False) -> None:
"""Initializer.
.. versionchanged:: 8.4
check for valid extensions.
+ .. versionchanged:: 9.3
+ *ignore_extension* parameter was added
:param source: the source of the page
:type source: pywikibot.page.BaseLink (or subclass),
pywikibot.page.Page (or subclass), or pywikibot.page.Site
:param title: normalized title of the page; required if source is a
Site, ignored otherwise
+ :param ignore_extension: prevent extension check
:raises ValueError: Either the title is not in the file
- namespace or does not have a valid extension.
+ namespace or does not have a valid extension and
+ *ignore_extension* was not set.
"""
self._file_revisions = {} # dictionary to cache File history.
super().__init__(source, title, 6)
if self.namespace() != 6:
raise ValueError(f"'{self.title()}' is not in the file namespace!")
+ if ignore_extension:
+ return
+
title = self.title(with_ns=False, with_section=False)
_, sep, extension = title.rpartition('.')
if not sep or extension.lower() not in self.site.file_extensions:
diff --git a/scripts/delinker.py b/scripts/delinker.py
index cb78714..13513ac 100755
--- a/scripts/delinker.py
+++ b/scripts/delinker.py
@@ -19,12 +19,11 @@
stops, the last timestamp is written to the settings file and
the next script call starts there if no `-since` is given.
-.. note:: This sample script is a
- :class:`ConfigParserBot <bot.ConfigParserBot>`. All
- settings can be made either by giving option with the command line or
- with a settings file which is scripts.ini by default. If you don't
- want the default values you can add any option you want to change to
- that settings file below the [delinker] section like.
+.. note:: This script is a :class:`ConfigParserBot <bot.ConfigParserBot>`.
+ All settings can be made either by giving option with the command
+ line or with a settings file which is scripts.ini by default. If you
+ don't want the default values you can add any option you want to
+ change to that settings file below the [delinker] section like.
.. versionadded:: 7.2
This script is completely rewriten from compat branch.
@@ -89,7 +88,7 @@
def init_page(self, item) -> pywikibot.page.FilePage:
"""Upcast logevent to FilePage and combine edit summary."""
self.summary_parameters = dict(item)
- return pywikibot.FilePage(self.site, item['title'])
+ return pywikibot.FilePage(item.page(), ignore_extension=True)
def skip_page(self, page) -> bool:
"""Skip pages which neither exists locally nor on shared repository."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1054503?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: Ic7fe1750113047654c5660ff2de245a0a37279da
Gerrit-Change-Number: 1054503
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Aram <arambakr1620(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1054341?usp=email )
Change subject: [cleanup]] deprecate BasePage.userName() and BasePage(isIpEdit)
......................................................................
[cleanup]] deprecate BasePage.userName() and BasePage(isIpEdit)
BasePage.userName() is too similar with User.username and can easily
replaced by latest_revision.user.
BasePage.isIpEdit() can easily be replaced by latest_revision.anon.
BasePage.editTime() is already deprecated and can be replaced by
latest_revision.timestamp.
Update scripts and tests
Change-Id: Ib0ec97de6b166668d92b0c2dd7bb29479d342a9b
---
M pywikibot/page/_basepage.py
M scripts/clean_sandbox.py
M scripts/noreferences.py
M tests/page_tests.py
4 files changed, 27 insertions(+), 8 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 596bacc..aba8ab5 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -743,12 +743,24 @@
includecomments=includecomments)
return self._expanded_text
+ @deprecated('latest_revision.user', since='9.3.0')
def userName(self) -> str:
- """Return name or IP address of last user to edit page."""
+ """Return name or IP address of last user to edit page.
+
+ .. deprecated:: 9.3
+ Use :attr:`latest_revision.user<latest_revision>`
+ instead.
+ """
return self.latest_revision.user # type: ignore[attr-defined]
+ @deprecated('latest_revision.anon', since='9.3.0')
def isIpEdit(self) -> bool:
- """Return True if last editor was unregistered."""
+ """Return True if last editor was unregistered.
+
+ .. deprecated:: 9.3
+ Use :attr:`latest_revision.anon<latest_revision>`
+ instead.
+ """
return self.latest_revision.anon # type: ignore[attr-defined]
@cached
diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py
index 6b450cb..44fb69d 100755
--- a/scripts/clean_sandbox.py
+++ b/scripts/clean_sandbox.py
@@ -248,12 +248,14 @@
else:
translated_msg = i18n.twtranslate(
self.site, 'clean_sandbox-cleaned')
+
subst = 'subst:' in self.translated_content
pos = text.find(self.translated_content.strip())
+ latest_user = sandbox_page.latest_revision.user
if text.strip() == self.translated_content.strip():
pywikibot.info(
'The sandbox is still clean, no change necessary.')
- elif subst and sandbox_page.userName() == self.site.user():
+ elif subst and latest_user == self.site.user():
pywikibot.info(
'The sandbox might be clean, no change necessary.')
elif pos != 0 and not subst:
diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index 5ad450b..a13a1dc 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -775,7 +775,7 @@
if super().skip_page(page):
return True
- if self.site.sitename == 'wikipedia:en' and page.isIpEdit():
+ if self.site.sitename == 'wikipedia:en' and page.latest_revision.anon:
pywikibot.warning(
f'Page {page} is edited by IP. Possible vandalized')
return True
diff --git a/tests/page_tests.py b/tests/page_tests.py
index 0df6d1a..c4bcd8c 100755
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -464,15 +464,20 @@
# we only check that the returned objects are of correct type.
self.assertIsInstance(mainpage.get(), str)
self.assertIsInstance(mainpage.latest_revision_id, int)
- self.assertIsInstance(mainpage.userName(), str)
- self.assertIsInstance(mainpage.isIpEdit(), bool)
+
+ with suppress_warnings(
+ r'pywikibot\.page\._basepage.BasePage\.\w+ is deprecated since '
+ r'release [89]\.[03]\.0; use latest_revision\..+ instead\.',
+ FutureWarning):
+ self.assertIsInstance(mainpage.userName(), str)
+ self.assertIsInstance(mainpage.isIpEdit(), bool)
+ self.assertIsInstance(mainpage.editTime(), pywikibot.Timestamp)
+
self.assertIsInstance(mainpage.exists(), bool)
self.assertIsInstance(mainpage.isRedirectPage(), bool)
self.assertIsInstance(mainpage.isDisambig(), bool)
self.assertIsInstance(mainpage.has_permission(), bool)
self.assertIsInstance(mainpage.botMayEdit(), bool)
- self.assertIsInstance(mainpage.latest_revision.timestamp,
- pywikibot.Timestamp)
self.assertIsInstance(mainpage.permalink(), str)
def test_talk_page(self):
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1054341?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: Ib0ec97de6b166668d92b0c2dd7bb29479d342a9b
Gerrit-Change-Number: 1054341
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1055910?usp=email )
Change subject: Localisation updates from https://translatewiki.net.
......................................................................
Localisation updates from https://translatewiki.net.
Change-Id: I3c61808a840536dc819d965cfec7b6008f29bfb6
---
M redirect/it.json
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
L10n-bot: Looks good to me, approved
jenkins-bot: Verified
diff --git a/redirect/it.json b/redirect/it.json
index 14b2d39..1864963 100644
--- a/redirect/it.json
+++ b/redirect/it.json
@@ -8,9 +8,9 @@
]
},
"redirect-broken-redirect-template": "{{Cancella subito|9}}",
- "redirect-fix-broken-moved": "Correggo reindirizzamento interrotto alla pagina spostata %(to)s",
- "redirect-fix-double": "Sistemo i redirect doppi a %(to)s",
- "redirect-fix-loop": "Correggo ciclo di reindirizzamento a %(to)s",
+ "redirect-fix-broken-moved": "Correggo reindirizzamento interrotto da %(from)s alla pagina spostata %(to)s",
+ "redirect-fix-double": "Sistemo i reindirizzamenti doppi da %(from)s a %(to)s",
+ "redirect-fix-loop": "Correggo ciclo di reindirizzamento da %(from)s a %(to)s",
"redirect-remove-broken": "Reindirizzamento a una pagina cancellata o inesistente",
"redirect-remove-loop": "La destinazione del reindirizzamento rimanda alla pagina di partenza"
}
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1055910?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/i18n
Gerrit-Branch: master
Gerrit-Change-Id: I3c61808a840536dc819d965cfec7b6008f29bfb6
Gerrit-Change-Number: 1055910
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot <l10n-bot(a)translatewiki.net>
Gerrit-Reviewer: L10n-bot <l10n-bot(a)translatewiki.net>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1055599?usp=email )
Change subject: [tests] skip connected page within unconnected_pages tests
......................................................................
[tests] skip connected page within unconnected_pages tests
The connection can be established in meantime.
Bug: T370596
Change-Id: I182dd058d36b87ecf5baed1e3721c5b7e6530482
---
M tests/pagegenerators_tests.py
M tests/site_generators_tests.py
2 files changed, 29 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 7efd78f..7d1aaa1 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -28,7 +28,7 @@
WikibaseItemFilterPageGenerator,
)
from pywikibot.tools import has_module
-from tests import join_data_path
+from tests import join_data_path, unittest_print
from tests.aspects import (
DefaultSiteTestCase,
DeprecationTestCase,
@@ -1699,10 +1699,21 @@
pattern = (fr'Page \[\[({site.sitename}:|{site.code}:)-1\]\]'
r" doesn't exist\.")
+ found = []
for page in pages:
- with self.subTest(page=page), self.assertRaisesRegex(
- NoPageError, pattern):
- page.data_item()
+ with self.subTest(page=page):
+ try:
+ page.data_item()
+ except NoPageError as e:
+ self.assertRegex(str(e), pattern)
+ else:
+ found.append(page)
+ if found:
+ unittest_print('connection found for ',
+ ', '.join(str(p) for p in found))
+
+ # assume that we have at least one unconnected page
+ self.assertLess(len(found), 3)
def test_unconnected_without_repo(self):
"""Test that it raises a ValueError on sites without repository."""
diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py
index 86c98e0..75bd805 100755
--- a/tests/site_generators_tests.py
+++ b/tests/site_generators_tests.py
@@ -690,10 +690,21 @@
pattern = (fr'Page \[\[({site.sitename}:|{site.code}:)-1\]\]'
r" doesn't exist\.")
+ found = []
for page in pages:
- with self.subTest(page=page), self.assertRaisesRegex(
- NoPageError, pattern):
- page.data_item()
+ with self.subTest(page=page):
+ try:
+ page.data_item()
+ except NoPageError as e:
+ self.assertRegex(str(e), pattern)
+ else:
+ found.append(page)
+ if found:
+ unittest_print('connection found for ',
+ ', '.join(str(p) for p in found))
+
+ # assume that we have at least one unconnected page
+ self.assertLess(len(found), 3)
class TestSiteGeneratorsUsers(DefaultSiteTestCase):
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1055599?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: I182dd058d36b87ecf5baed1e3721c5b7e6530482
Gerrit-Change-Number: 1055599
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1055597?usp=email )
Change subject: [IMPR] expand redirect messages to show the old redirect target
......................................................................
[IMPR] expand redirect messages to show the old redirect target
Bug: T254839
Change-Id: I27d8a3f4febe87ca89c88297da0a34c9815ca790
---
M redirect/en.json
M redirect/qqq.json
2 files changed, 6 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/redirect/en.json b/redirect/en.json
index 9bf65ea..ace067d 100644
--- a/redirect/en.json
+++ b/redirect/en.json
@@ -5,9 +5,9 @@
]
},
"redirect-broken-redirect-template": "{{db-r1}}",
- "redirect-fix-broken-moved": "Fixing broken redirect to moved target page %(to)s",
- "redirect-fix-double": "Fixing double redirect to %(to)s",
- "redirect-fix-loop": "Fixing redirect loop to %(to)s",
+ "redirect-fix-broken-moved": "Fixing broken redirect from %(from)s to moved target page %(to)s",
+ "redirect-fix-double": "Fixing double redirect from %(from)s to %(to)s",
+ "redirect-fix-loop": "Fixing redirect loop from %(from)s to %(to)s",
"redirect-remove-broken": "Redirect to a deleted or non-existent page",
"redirect-remove-loop": "Redirect target forms a redirect loop"
}
diff --git a/redirect/qqq.json b/redirect/qqq.json
index ed793f7..4ced5b2 100644
--- a/redirect/qqq.json
+++ b/redirect/qqq.json
@@ -9,9 +9,9 @@
]
},
"redirect-broken-redirect-template": "{{doc-important|Only use your deletion template like <code><nowiki>{{delete}}</nowiki></code> which exist on your local project.}}\n\nNOTE TO TRANSLATOR: This should only be translated by someone on the Wikipedia of your language code. Thank you.\n\nTemplate for speedy deletion of broken redirect or redirect loops which the bot tags onto the redirect page. This message may contain additional informations like template parameters or reasons for the deletion request.\n\nNOTE: If this system message is not given for a language code, speedy deletion request by a bot is not supported on your site except there is a bot with sysop flag.",
- "redirect-fix-broken-moved": "Edit summary when the bot fixes a broken redirect to a moved page whose origin has been deleted.\nParameters:\n* <code>%(to)s</code>: the new redirect target, as a wiki link.",
- "redirect-fix-double": "Edit summary when the bot fixes double redirects. <code>%(to)s</code> displays the new redirect target as a wiki link.",
- "redirect-fix-loop": "Edit summary when the bot fixes redirect loops. <code>%(to)s</code> displays the new redirect target as a wiki link.",
+ "redirect-fix-broken-moved": "Edit summary when the bot fixes a broken redirect to a moved page whose origin has been deleted.\nParameters:\n* <code>%(from)s: the old redirect target\n* <code>%(to)s</code>: the new redirect target, as a wiki link.",
+ "redirect-fix-double": "Edit summary when the bot fixes double redirects.\nParameters:\n* <code>%(from)s: the old redirect target as wiki link\n* <code>%(to)s</code> displays the new redirect target as a wiki link.",
+ "redirect-fix-loop": "Edit summary when the bot fixes redirect loops.\nParameters:\n* <code>%(from)s: the old redirect target as wiki link\n* <code>%(to)s</code> displays the new redirect target as a wiki link.",
"redirect-remove-broken": "Edit summary when the bot tags a deleted or non-existent page for speedy deletion.",
"redirect-remove-loop": "Edit summary when the bot tags a redirect loop for speedy deletion."
}
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1055597?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/i18n
Gerrit-Branch: master
Gerrit-Change-Id: I27d8a3f4febe87ca89c88297da0a34c9815ca790
Gerrit-Change-Number: 1055597
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot