jenkins-bot merged this change.
[bugfix] Adjust page counter in LiveBotTestCase
- With Id9885f7a the page counter was adjusted and skipped pages are
no longer counted. Adjust page counter in LiveBotTestCase._missing_generator
accordingly
- Also fix message strings. str.format can handle properties or
attribute only but it fails for functions.
Bug: T195696
Change-Id: I7a7e5c55c5f1e7859078174cb89110b55e4e2502
---
M pywikibot/bot.py
M tests/bot_tests.py
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 44664f5..7eaae7c 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1621,7 +1621,7 @@
"""Skip page it's site is not on the defined site."""
if page.site != self.site:
pywikibot.warning(
- fill('Skipped "{page}" due to: '
+ fill('Skipped {page} due to: '
'The bot is on site "{site}" but the page on '
'site "{page.site}"'.format(site=self.site, page=page)))
return True
@@ -1760,7 +1760,7 @@
"""Treat page if it exists and handle NoPage from it."""
if not page.exists():
pywikibot.warning(
- 'Page "{page.title()}" does not exist on {page.site}.'
+ 'Page {page} does not exist on {page.site}.'
.format(page=page))
return True
return super(ExistingPageBot, self).skip_page(page)
@@ -1785,7 +1785,7 @@
"""Treat page if doesn't exist."""
if page.exists():
pywikibot.warning(
- 'Page "{page.title()}" does already exist on {page.site}.'
+ 'Page {page} does already exist on {page.site}.'
.format(page=page))
return True
return super(CreatingPageBot, self).skip_page(page)
@@ -1799,7 +1799,7 @@
"""Treat only redirect pages and handle IsNotRedirectPage from it."""
if not page.isRedirectPage():
pywikibot.warning(
- 'Page "{page.title()}" on {page.site} is skipped because it is'
+ 'Page {page} on {page.site} is skipped because it is'
'not a redirect'.format(page=page))
return True
return super(RedirectPageBot, self).skip_page(page)
@@ -1813,7 +1813,7 @@
"""Treat only non-redirect pages and handle IsRedirectPage from it."""
if page.isRedirectPage():
pywikibot.warning(
- 'Page "{page.title()}" on {page.site} is skipped because it is'
+ 'Page {page} on {page.site} is skipped because it is'
'a redirect'.format(page=page))
return True
return super(NoRedirectPageBot, self).skip_page(page)
diff --git a/tests/bot_tests.py b/tests/bot_tests.py
index 5cfade3..da9c7b3 100644
--- a/tests/bot_tests.py
+++ b/tests/bot_tests.py
@@ -314,7 +314,7 @@
def _missing_generator(self):
"""Yield pages and the last one does not exist."""
- self._count = 1
+ self._count = 0 # skip_page skips one page
self._current_page = list(self.site.allpages(total=1))[0]
yield self._current_page
while self._current_page.exists():
To view, visit change 435696. To unsubscribe, visit settings.