Hello PywikibotCommitWatcher,
I'd like you to do a code review. Please visit
https://gerrit.wikimedia.org/r/234734
to review the following change.
Change subject: WIP: Replacing old Bugzilla tickets with Phab.
......................................................................
WIP: Replacing old Bugzilla tickets with Phab.
A request was made to modify pywiki files with old references to bugzilla
tickets to phabricator ones. In the cases where the ticket was linked via
URL, I've not performed any change as those links still work as a
redirect. In those cases where the ticket was simply a number reference, I
updated it adding 2,000 to the ticket number and adding a 'T' before the
number, so it's clear it's a Phabricator task. I tag this as work in
progress because the files have changed since the ticket was opened and I
don't know whether further files will need amendment.
Bug: T94683
Change-Id: Ib775bfdbc96311ccb09ad9a1ee77b9970c09fd43
---
M pywikibot/data/api.py
M pywikibot/exceptions.py
M pywikibot/login.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
M pywikibot/site.py
M pywikibot/textlib.py
M scripts/blockpageschecker.py
M scripts/reflinks.py
M scripts/unusedfiles.py
M tests/archivebot_tests.py
M tests/script_tests.py
M tests/site_tests.py
13 files changed, 27 insertions(+), 27 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/34/234734/1
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index c85f851..dd7f555 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1782,7 +1782,7 @@
def _is_wikibase_error_retryable(self, error):
ERR_MSG = u'edit-already-exists'
messages = error.pop("messages", None)
- # bug 66619, after gerrit 124323 breaking change we have a
+ # bug 66619 (T68619), after gerrit 124323 breaking change we have a
# list of messages
if isinstance(messages, list):
for item in messages:
@@ -1861,7 +1861,7 @@
if '*' in warning:
text = warning['*']
elif 'html' in warning:
- # Bugzilla 49978
+ # Phabricator T51978
text = warning['html']['*']
else:
pywikibot.warning(
@@ -2051,9 +2051,9 @@
del error['code'] # is added via class_name
e = APIMWException(class_name, **error)
- retry = class_name in ['DBConnectionError', # bug 62974
- 'DBQueryError', # bug 58158
- 'ReadOnlyError' # bug 59227
+ retry = class_name in ['DBConnectionError', # T64974
+ 'DBQueryError', # T60158
+ 'ReadOnlyError' # T61227
]
pywikibot.error("Detected MediaWiki API exception %s%s"
@@ -2078,8 +2078,8 @@
raise e
- # bugs 46535, 62126, 64494, 66619
- # maybe removed when it 46535 is solved
+ # Phab. tickets T48535, T64126, T68494, T68619
+ # maybe removed when T48535 is solved
if code == "failed-save" and \
self.action == 'wbeditentity' and \
self._is_wikibase_error_retryable(result["error"]):
@@ -2651,7 +2651,7 @@
# self.resultkey in data in last request.submit()
new_limit = min(self.query_limit, self.limit - count)
else:
- # only "(query-)continue" returned. See Bug 72209.
+ # only "(query-)continue" returned. See Bug T74209.
# increase new_limit to advance faster until new
# useful data are found again.
new_limit = min(new_limit * 2, self.query_limit)
diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py
index a8a8beb..1e79596 100644
--- a/pywikibot/exceptions.py
+++ b/pywikibot/exceptions.py
@@ -290,7 +290,7 @@
"""
Page is a redirect to another site.
- This is considered invalid in Pywikibot. See Bug 73184.
+ This is considered invalid in Pywikibot. See Bug T75184.
"""
diff --git a/pywikibot/login.py b/pywikibot/login.py
index ac37803..26a07db 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -283,7 +283,7 @@
elif e.code == 'Illegal':
raise NoUsername(u"Username '%s' is invalid on %s"
% (self.username, self.site))
- # TODO: investigate other unhandled API codes (bug 73539)
+ # TODO: investigate other unhandled API codes (bug 75539)
if retry:
self.password = None
return self.login(retry=True)
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 890796a..eb8eb9d 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -540,7 +540,7 @@
@return: dict
"""
if not hasattr(self, '_pageprops') or force:
- self._pageprops = {} # page may not have pageprops (see bug 54868)
+ self._pageprops = {} # page may not have pageprops (see bug T56868)
self.site.loadpageprops(self)
return self._pageprops
@@ -1402,7 +1402,7 @@
@return: a generator that yields Category objects.
"""
- # FIXME: bug 73561: withSortKey is ignored by Site.pagecategories
+ # FIXME: bug T75561: withSortKey is ignored by Site.pagecategories
if withSortKey:
raise NotImplementedError('withSortKey is not implemented')
@@ -3314,7 +3314,7 @@
self.labels = {}
if 'labels' in self._content:
for lang in self._content['labels']:
- if 'removed' not in self._content['labels'][lang]: # Bug 54767
+ if 'removed' not in self._content['labels'][lang]: # Bug T56767
self.labels[lang] = self._content['labels'][lang]['value']
# descriptions
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 3afe643..3ed516f 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -684,7 +684,7 @@
u'How many images do you want to load?')
gen = NewimagesPageGenerator(total=int(limit), site=self.site)
elif arg.startswith('-newpages'):
- # partial workaround for bug 67249
+ # partial workaround for bug T69249
# to use -namespace/ns with -newpages, -ns must be given
# before -newpages
# otherwise default namespace is 0
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 3f3fe9f..098ec65 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2727,7 +2727,7 @@
def page_isredirect(self, page):
"""Return True if and only if page is a redirect."""
if not hasattr(page, "_isredir"):
- page._isredir = False # bug 54684
+ page._isredir = False # bug T56684
self.loadpageinfo(page)
return page._isredir
@@ -5297,7 +5297,7 @@
comment=comment, text=text,
filekey=_file_key)
elif source_filename:
- # TODO: Dummy value to allow also Unicode names, see bug 73661
+ # TODO: Dummy value to allow also Unicode names, see bug T75661
mime_filename = 'FAKE-NAME'
# upload local file
# make sure file actually exists
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index bd7adbd..4bd66b6 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -300,7 +300,7 @@
# We cannot just insert the new string, as it may contain regex
# group references such as \2 or \g<name>.
# On the other hand, this approach does not work because it
- # can't handle lookahead or lookbehind (see bug #1731008):
+ # can't handle lookahead or lookbehind (see bug #1731008)(bug not found):
#
# replacement = old.sub(new, text[match.start():match.end()])
# text = text[:match.start()] + replacement + text[match.end():]
@@ -1726,7 +1726,7 @@
if m:
marker = self.findmarker(txt)
- # month and day format might be identical (e.g. see bug 69315),
+ # month and day format might be identical (e.g. see bug T71315),
# avoid to wipe out day, after month is matched.
# replace all matches but the last two
# (i.e. allow to search for dd. mm.)
diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index c4ca412..f00a2ea 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -297,7 +297,7 @@
continue
# FIXME: This check does not work :
# PreloadingGenerator cannot set correctly page.editRestriction
- # (see bug 55322)
+ # (see bug T57322)
# if not page.canBeEdited():
# pywikibot.output("%s is sysop-protected : this account can't edit "
# "it! Skipping..." % pagename)
diff --git a/scripts/reflinks.py b/scripts/reflinks.py
index 6b3978f..a0c4ed0 100755
--- a/scripts/reflinks.py
+++ b/scripts/reflinks.py
@@ -710,7 +710,7 @@
if 'utf-8' not in enc:
enc.append('utf-8')
try:
- u = linkedpagetext.decode(enc[0]) # Bug 67410
+ u = linkedpagetext.decode(enc[0]) # Bug T69410
except (UnicodeDecodeError, LookupError) as e:
pywikibot.output(u'%s : Decoding error - %s' % (ref.link, e))
continue
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py
index 30140aa..26f62dd 100755
--- a/scripts/unusedfiles.py
+++ b/scripts/unusedfiles.py
@@ -68,7 +68,7 @@
generator = pagegenerators.PreloadingGenerator(generator)
for image in generator:
if not image.exists():
- pywikibot.output(u"File '%s' does not exist (see bug 69133)."
+ pywikibot.output(u"File '%s' does not exist (see bug T71133)."
% image.title())
continue
# Use fileUrl() and fileIsShared() to confirm it is local media
diff --git a/tests/archivebot_tests.py b/tests/archivebot_tests.py
index 819faf1..1e99b1e 100644
--- a/tests/archivebot_tests.py
+++ b/tests/archivebot_tests.py
@@ -43,7 +43,7 @@
def test_archivebot(self, code=None):
"""Test archivebot for one site."""
site = self.get_site(code)
- if code != 'de': # bug 67663
+ if code != 'de': # bug T69663
page = pywikibot.Page(site, 'user talk:xqt')
else:
page = pywikibot.Page(site, 'user talk:ladsgroup')
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 3fd9596..0b4f43d 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -126,7 +126,7 @@
# and not backtraces starting deep in the pywikibot package.
no_args_expected_results = {
# TODO: until done here, remember to set editor = None in user_config.py
- 'editarticle': 'Nothing changed', # This masks related bug 68645 but that
+ 'editarticle': 'Nothing changed', # This masks related bug T70645 but that
# bug is more broadly about config
# rather than editarticle.
'freebasemappingupload': 'Cannot find ',
@@ -139,7 +139,7 @@
'replace': 'Press Enter to use this automatic message',
'script_wui': 'Pre-loading all relevant page contents',
'shell': ('>>> ', 'Welcome to the'),
- 'transferbot': 'Target site not different from source site', # Bug 68662
+ 'transferbot': 'Target site not different from source site', # Bug T70662
'unusedfiles': ('Working on', None),
'watchlist': 'Retrieving watchlist',
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 5b23525..12c9a17 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -605,7 +605,7 @@
for cat in mysite.allcategories(total=5, prefix="Def"):
self.assertIsInstance(cat, pywikibot.Category)
self.assertTrue(cat.title(withNamespace=False).startswith("Def"))
- # Bug # 15985 - reverse and start combined; fixed in v 1.14
+ # Bug # T17985 - reverse and start combined; fixed in v 1.14
for cat in mysite.allcategories(total=5, start="Hij", reverse=True):
self.assertIsInstance(cat, pywikibot.Category)
self.assertLessEqual(cat.title(withNamespace=False), "Hij")
@@ -664,7 +664,7 @@
self.assertIsInstance(impage, pywikibot.FilePage)
self.assertTrue(mysite.page_exists(impage))
self.assertGreaterEqual(impage.title(withNamespace=False), "Ba")
- # Bug # 15985 - reverse and start combined; fixed in v 1.14
+ # Bug # T17985 - reverse and start combined; fixed in v 1.14
for impage in mysite.allimages(start="Da", reverse=True, total=5):
self.assertIsInstance(impage, pywikibot.FilePage)
self.assertTrue(mysite.page_exists(impage))
@@ -922,7 +922,7 @@
self.assertIsInstance(using, pywikibot.Page)
if using.isRedirectPage():
print('{0} is a redirect, although just non-redirects were '
- 'searched. See also bug 73120'.format(using))
+ 'searched. See also bug T75120'.format(using))
self.assertFalse(using.isRedirectPage())
--
To view, visit https://gerrit.wikimedia.org/r/234734
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib775bfdbc96311ccb09ad9a1ee77b9970c09fd43
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: MarcoAurelio <strigiwm(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: PywikibotCommitWatcher <pywikibot-commits(a)lists.wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: pagegenerators.py: explain LinksearchPageGenerator params
......................................................................
pagegenerators.py: explain LinksearchPageGenerator params
Improve docstring of LinksearchPageGenerator() to explain that protocol
must not be part of the input parameter.
Rename parameter link->url:
- same name used by the corresponding site.exturlusage() function
- url is the name used in API documentation
- link is ambigous as in can be intended as wikilink
Bug: T112852
Change-Id: I13515ea412711dfaf02d89a5e11234c8859df8cf
---
M pywikibot/pagegenerators.py
M pywikibot/site.py
2 files changed, 11 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index ecffb9a..9198dca 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -2054,13 +2054,17 @@
yield page
-@deprecated_args(euprotocol='protocol')
-def LinksearchPageGenerator(link, namespaces=None, step=None, total=None,
+@deprecated_args(link='url', euprotocol='protocol')
+def LinksearchPageGenerator(url, namespaces=None, step=None, total=None,
site=None, protocol='http'):
- """Yield all pages that include a specified link.
+ """Yield all pages that link to a certain URL, like Special:Linksearch.
- Obtains data from [[Special:Linksearch]].
-
+ @param url: The URL to search for (without the protocol prefix);
+ this may include a '*' as a wildcard, only at the start of the
+ hostname
+ @type url: str
+ @param namespaces: list of namespace numbers to fetch contribs from
+ @type namespaces: list of int
@param step: Maximum number of pages to retrieve per API query
@type step: int
@param total: Maxmum number of pages to retrieve in total
@@ -2070,7 +2074,7 @@
"""
if site is None:
site = pywikibot.Site()
- return site.exturlusage(link, namespaces=namespaces, protocol=protocol,
+ return site.exturlusage(url, namespaces=namespaces, protocol=protocol,
step=step, total=total, content=False)
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 54c40d9..384f333 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -4122,7 +4122,7 @@
"""Iterate Pages that contain links to the given URL.
@param url: The URL to search for (without the protocol prefix);
- this many include a '*' as a wildcard, only at the start of the
+ this may include a '*' as a wildcard, only at the start of the
hostname
@param protocol: The protocol prefix (default: "http")
--
To view, visit https://gerrit.wikimedia.org/r/250183
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I13515ea412711dfaf02d89a5e11234c8859df8cf
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Allow pywikibot to run on Windows 10 as well
......................................................................
Allow pywikibot to run on Windows 10 as well
Change-Id: I5c334d28dec7acfd0c65aef02f8144afee82275c
---
M pywikibot/config2.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 419e825..5f82eaa 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -294,10 +294,10 @@
base_dir_cand = []
home = os.path.expanduser("~")
if OSWIN32:
- win_version = int(platform.version()[0])
+ win_version = int(platform.version().split(".")[0])
if win_version == 5:
sub_dir = ["Application Data"]
- elif win_version == 6:
+ elif win_version in (6, 10):
sub_dir = ["AppData", "Roaming"]
else:
raise WindowsError(u'Windows version %s not supported yet.'
--
To view, visit https://gerrit.wikimedia.org/r/255334
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5c334d28dec7acfd0c65aef02f8144afee82275c
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Hazard-SJ <hazard_sj(a)yahoo.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [IMPR] use the more flexible pywikibot.Timestamp for TimeStripper.timestripper
......................................................................
[IMPR] use the more flexible pywikibot.Timestamp for TimeStripper.timestripper
Change-Id: I76ffffdfa4bdcd5a9c9e7447cab3c0a5d2b46289
---
M pywikibot/textlib.py
1 file changed, 4 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index f5c2888..05e0b8b 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -1684,7 +1684,7 @@
class TimeStripper(object):
- """Find timestamp in page and return it as timezone aware datetime object."""
+ """Find timestamp in page and return it as pywikibot.Timestamp object."""
def __init__(self, site=None):
"""Constructor."""
@@ -1795,6 +1795,8 @@
All the following items must be matched, otherwise None is returned:
-. year, month, hour, time, day, minute, tzinfo
+ @return: A timestamp found on the given line
+ @rtype: pywikibot.Timestamp
"""
# match date fields
dateDict = dict()
@@ -1846,7 +1848,7 @@
# find timezone
dateDict['tzinfo'] = self.tzinfo
- timestamp = datetime.datetime(**dateDict)
+ timestamp = pywikibot.Timestamp(**dateDict)
else:
timestamp = None
--
To view, visit https://gerrit.wikimedia.org/r/253869
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I76ffffdfa4bdcd5a9c9e7447cab3c0a5d2b46289
Gerrit-PatchSet: 7
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #3081
Status: Failed
Duration: 35 minutes and 53 seconds
Commit: a7a58b3 (master)
Author: Fabian Neundorf
Message: [IMPROV] TimeStripper: Deprecate findmarker duplicate
The `findmarker` method in `TimeStripper` works exactly the same as the
function in the module. This is deprecating the method in the class in favour
of the module function.
This is also introducing a new super class in the corresponding tests which
will take care of creating the `TimeStripper` instance.
Change-Id: Ia349e78e68d94fc6c6ceab75d8b679bbee48b2b7
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/94f26cbe2c81...a7a58b3d…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/91992215
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
jenkins-bot has submitted this change and it was merged.
Change subject: [IMPROV] TimeStripper: Deprecate findmarker duplicate
......................................................................
[IMPROV] TimeStripper: Deprecate findmarker duplicate
The `findmarker` method in `TimeStripper` works exactly the same as the
function in the module. This is deprecating the method in the class in favour
of the module function.
This is also introducing a new super class in the corresponding tests which
will take care of creating the `TimeStripper` instance.
Change-Id: Ia349e78e68d94fc6c6ceab75d8b679bbee48b2b7
---
M pywikibot/textlib.py
M tests/timestripper_tests.py
2 files changed, 32 insertions(+), 24 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 54d20eb..f5c2888 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -39,6 +39,7 @@
from pywikibot.exceptions import InvalidTitle
from pywikibot.family import Family
from pywikibot.tools import (
+ deprecated,
DeprecatedRegex,
OrderedDict,
UnicodeType,
@@ -1747,11 +1748,10 @@
self.tzinfo = tzoneFixedOffset(self.site.siteinfo['timeoffset'],
self.site.siteinfo['timezone'])
+ @deprecated('module function')
def findmarker(self, text, base=u'@@', delta='@'):
"""Find a string which is not part of text."""
- while base in text:
- base += delta
- return base
+ return findmarker(text, base, delta)
def fix_digits(self, line):
"""Make non-latin digits like Persian to latin to parse."""
@@ -1772,7 +1772,7 @@
cnt += 1
if m:
- marker = self.findmarker(txt)
+ marker = findmarker(txt)
# month and day format might be identical (e.g. see bug 69315),
# avoid to wipe out day, after month is matched.
# replace all matches but the last two
diff --git a/tests/timestripper_tests.py b/tests/timestripper_tests.py
index 61a20ab..4c5a9fc 100644
--- a/tests/timestripper_tests.py
+++ b/tests/timestripper_tests.py
@@ -13,28 +13,45 @@
from pywikibot.textlib import TimeStripper, tzoneFixedOffset
-from tests.aspects import unittest, TestCase
+from tests.aspects import (
+ unittest,
+ TestCase,
+ DefaultSiteTestCase,
+ DeprecationTestCase,
+)
-class TestTimeStripperWithNoDigitsAsMonths(TestCase):
+class TestTimeStripperCase(TestCase):
- """Test cases for TimeStripper methods."""
-
- family = 'wikipedia'
- code = 'fr'
+ """Basic class to test the TimeStripper class."""
cached = True
def setUp(self):
"""Set up test cases."""
- super(TestTimeStripperWithNoDigitsAsMonths, self).setUp()
+ super(TestTimeStripperCase, self).setUp()
self.ts = TimeStripper(self.get_site())
+
+
+class DeprecatedTestTimeStripperCase(TestTimeStripperCase, DeprecationTestCase,
+ DefaultSiteTestCase):
+
+ """Test deprecated parts of the TimeStripper class."""
def test_findmarker(self):
"""Test that string which is not part of text is found."""
txt = u'this is a string with a maker is @@@@already present'
self.assertEqual(self.ts.findmarker(txt, base=u'@@', delta='@@'),
'@@@@@@')
+ self.assertOneDeprecation()
+
+
+class TestTimeStripperWithNoDigitsAsMonths(TestTimeStripperCase):
+
+ """Test cases for TimeStripper methods."""
+
+ family = 'wikipedia'
+ code = 'fr'
def test_last_match_and_replace(self):
"""Test that pattern matches and removes items correctly."""
@@ -88,19 +105,12 @@
self.assertEqual(self.ts.timestripper(txtHourOutOfRange), None)
-class TestTimeStripperWithDigitsAsMonths(TestCase):
+class TestTimeStripperWithDigitsAsMonths(TestTimeStripperCase):
"""Test cases for TimeStripper methods."""
family = 'wikipedia'
code = 'cs'
-
- cached = True
-
- def setUp(self):
- """Setup a timestripper for the configured site."""
- super(TestTimeStripperWithDigitsAsMonths, self).setUp()
- self.ts = TimeStripper(self.get_site())
def test_last_match_and_replace(self):
"""Test that pattern matches and removes items correctly."""
@@ -236,7 +246,7 @@
self.assertEqual(self.ts.timestripper(txtNoMatch), None)
-class TestTimeStripperDoNotArchiveUntil(TestCase):
+class TestTimeStripperDoNotArchiveUntil(TestTimeStripperCase):
"""Test cases for Do Not Archive Until templates.
@@ -247,8 +257,6 @@
family = 'wikisource'
code = 'en'
- cached = True
-
username = '[[User:DoNotArchiveUntil]]'
date = '06:57 06 June 2015 (UTC)'
user_and_date = username + ' ' + date
@@ -256,7 +264,7 @@
def test_timestripper_match(self):
"""Test that dates in comments are correctly recognised."""
- ts = TimeStripper(self.get_site())
+ ts = self.ts
txt_match = '<!-- [[User:Do___ArchiveUntil]] ' + self.date + ' -->'
res = datetime.datetime(2015, 6, 6, 6, 57, tzinfo=self.tzone)
@@ -272,7 +280,7 @@
def test_timestripper_match_only(self):
"""Test that latest date is used instead of other dates."""
- ts = TimeStripper(self.get_site())
+ ts = self.ts
later_date = '10:57 06 June 2015 (UTC)'
txt_match = '<!-- --> ' + self.user_and_date + ' <!-- -->' + later_date
--
To view, visit https://gerrit.wikimedia.org/r/253965
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia349e78e68d94fc6c6ceab75d8b679bbee48b2b7
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: login: clarify error message when user does not exist
......................................................................
login: clarify error message when user does not exist
Change-Id: I248d11a7ac13b9a14c45d2f8d481a65adb5f3fb9
---
M pywikibot/login.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/login.py b/pywikibot/login.py
index 2463a7f..b82512a 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -136,7 +136,7 @@
if user['name'] != self.username:
# Report the same error as server error code NotExists
- raise NoUsername('Username \'%s\' is invalid on %s'
+ raise NoUsername('Username \'%s\' does not exist on %s'
% (self.username, self.site))
def botAllowed(self):
--
To view, visit https://gerrit.wikimedia.org/r/253954
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I248d11a7ac13b9a14c45d2f8d481a65adb5f3fb9
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>