jenkins-bot has submitted this change and it was merged.
Change subject: [IMPROV] site tests: Separate deprecation classes
......................................................................
[IMPROV] site tests: Separate deprecation classes
Separate the tests which require just a live wiki but no user from the test
that also requires a logged in user.
Change-Id: I75e5986277cf628dfde86ad7435fec0440442fd5
---
M tests/site_tests.py
1 file changed, 23 insertions(+), 16 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 1781052..0d1f3a1 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -41,26 +41,12 @@
unicode = str
-class TestSiteObjectDeprecatedFunctions(DefaultSiteTestCase, DeprecationTestCase):
+class TestSiteUserDeprecatedFunctions(DefaultSiteTestCase, DeprecationTestCase):
- """Test cases for Site deprecated methods on a live wiki."""
+ """Test cases for Site deprecated methods requiring a live wiki and user."""
cached = True
user = True
-
- def test_live_version(self):
- """Test live_version."""
- mysite = self.get_site()
- ver = mysite.live_version()
- self.assertIsInstance(ver, tuple)
- self.assertTrue(all(isinstance(ver[i], int) for i in (0, 1)))
- self.assertIsInstance(ver[2], basestring)
- self.assertDeprecation()
-
- def test_getcurrenttime(self):
- """Test live_version."""
- self.assertEqual(self.site.getcurrenttime(), self.site.server_time())
- self.assertDeprecation()
def test_token(self):
"""Test ability to get page tokens."""
@@ -81,6 +67,27 @@
self.assertDeprecation("pywikibot.site.APISite.token is deprecated"
", use the 'tokens' property instead.")
+
+class TestSiteObjectDeprecatedFunctions(DefaultSiteTestCase, DeprecationTestCase):
+
+ """Test cases for Site deprecated methods on a live wiki."""
+
+ cached = True
+
+ def test_live_version(self):
+ """Test live_version."""
+ mysite = self.get_site()
+ ver = mysite.live_version()
+ self.assertIsInstance(ver, tuple)
+ self.assertTrue(all(isinstance(ver[i], int) for i in (0, 1)))
+ self.assertIsInstance(ver[2], basestring)
+ self.assertDeprecation()
+
+ def test_getcurrenttime(self):
+ """Test live_version."""
+ self.assertEqual(self.site.getcurrenttime(), self.site.server_time())
+ self.assertDeprecation()
+
def test_siteinfo_normal_call(self):
"""Test calling the Siteinfo without setting dump."""
old = self.site.siteinfo('general')
--
To view, visit https://gerrit.wikimedia.org/r/221092
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I75e5986277cf628dfde86ad7435fec0440442fd5
Gerrit-PatchSet: 1
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: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #2447
Status: Passed
Duration: 22 minutes and 34 seconds
Commit: 1e084ec (master)
Author: Fabian Neundorf
Message: [IMPROV] allpages: Issue deprecation warning
When an outdated value (aka not None, False or True) is used it's issuing a
deprecation warning with the old and new value.
Change-Id: I23d3bac5c29e5149d29ae3f81878440ae48c5df7
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/e282be437419...1e084ec6…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/68470588
--
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] allpages: Issue deprecation warning
......................................................................
[IMPROV] allpages: Issue deprecation warning
When an outdated value (aka not None, False or True) is used it's issuing a
deprecation warning with the old and new value.
Change-Id: I23d3bac5c29e5149d29ae3f81878440ae48c5df7
---
M pywikibot/site.py
M tests/site_tests.py
2 files changed, 15 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index a1eece9..f1901da 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3539,6 +3539,7 @@
"""
# backward compatibility test
if filterredir not in (True, False, None):
+ old = filterredir
if filterredir:
if filterredir == 'only':
filterredir = True
@@ -3546,6 +3547,8 @@
filterredir = None
else:
filterredir = False
+ warn('The value "{0!r}" for "filterredir" is deprecated, use '
+ '{1} instead.'.format(old, filterredir), DeprecationWarning, 3)
apgen = self._generator(api.PageGenerator, type_arg="allpages",
namespaces=namespace,
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 1781052..a43d5b4 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -102,6 +102,18 @@
self.assertIn('statistics', self.site.siteinfo('statistics', dump=True))
self.assertDeprecation('Calling siteinfo is deprecated, use itself instead.')
+ def test_allpages_filterredir_True(self):
+ """Test that filterredir set to 'only' is deprecated to True."""
+ for page in self.site.allpages(filterredir='only', total=1):
+ self.assertTrue(page.isRedirectPage())
+ self.assertDeprecation()
+
+ def test_allpages_filterredir_False(self):
+ """Test that if filterredir's bool is False it's deprecated to False."""
+ for page in self.site.allpages(filterredir='', total=1):
+ self.assertFalse(page.isRedirectPage())
+ self.assertDeprecation()
+
class TestSiteDryDeprecatedFunctions(DefaultDrySiteTestCase, DeprecationTestCase):
--
To view, visit https://gerrit.wikimedia.org/r/221095
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I23d3bac5c29e5149d29ae3f81878440ae48c5df7
Gerrit-PatchSet: 1
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: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Omit includeredirects parameter for allpages generator
......................................................................
Omit includeredirects parameter for allpages generator
- since includeredirects is listed in deprecated_args, it is never filed to
the allpages parameter list.
- rewrite the filterredir mapping for backward compatibility
- assign includeredirects to filterredir in prefixindex method
- update doc: parameter deprecation is trivially shown by the decorator.
Change-Id: Iea7ea1b5a014025c80cec9e96c9ed2cc177e3244
---
M pywikibot/site.py
1 file changed, 8 insertions(+), 10 deletions(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 3e1f637..a1eece9 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3503,15 +3503,13 @@
'subcats': 0}
return category._catinfo
- @deprecated_args(throttle=None, limit="total", includeredirects="filterredir")
+ @deprecated_args(throttle=None, limit='total',
+ includeredirects='filterredir')
def allpages(self, start="!", prefix="", namespace=0, filterredir=None,
filterlanglinks=None, minsize=None, maxsize=None,
protect_type=None, protect_level=None, reverse=False,
- includeredirects=None, step=None, total=None, content=False):
+ step=None, total=None, content=False):
"""Iterate pages in a single namespace.
-
- Note: parameters includeRedirects and throttle are deprecated and
- included only for backwards compatibility.
@param start: Start at this title (page need not exist).
@param prefix: Only yield pages starting with this string.
@@ -3533,16 +3531,16 @@
level; can only be used if protect_type is specified
@param reverse: if True, iterate in reverse Unicode lexigraphic
order (default: iterate in forward order)
- @param includeredirects: DEPRECATED, use filterredir instead
@param content: if True, load the current content of each iterated page
(default False)
@raises KeyError: the namespace identifier was not resolved
@raises TypeError: the namespace identifier has an inappropriate
type such as bool, or an iterable with more than one namespace
"""
- if includeredirects is not None:
- if includeredirects:
- if includeredirects == "only":
+ # backward compatibility test
+ if filterredir not in (True, False, None):
+ if filterredir:
+ if filterredir == 'only':
filterredir = True
else:
filterredir = None
@@ -3582,7 +3580,7 @@
"""
return self.allpages(prefix=prefix, namespace=namespace,
- includeredirects=includeredirects)
+ filterredir=includeredirects)
def alllinks(self, start="!", prefix="", namespace=0, unique=False,
fromids=False, step=None, total=None):
--
To view, visit https://gerrit.wikimedia.org/r/221062
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iea7ea1b5a014025c80cec9e96c9ed2cc177e3244
Gerrit-PatchSet: 5
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: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #2444
Status: Fixed
Duration: 27 minutes and 41 seconds
Commit: d15c73b (master)
Author: Fabian Neundorf
Message: [FIX] InteractiveReplace: Don't assume dict
When rebasing 0d42f6fb the type of _own_choices changed from dict into a list
(to preserve the order) but some of the underlying code hasn't been modified
accordingly.
Change-Id: I8d52adf17392b7ac3a251eacde7a178c9633c247
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/bf9e53dd60d3...d15c73b7…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/68299622
--
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: [FIX] InteractiveReplace: Don't assume dict
......................................................................
[FIX] InteractiveReplace: Don't assume dict
When rebasing 0d42f6fb the type of _own_choices changed from dict into a list
(to preserve the order) but some of the underlying code hasn't been modified
accordingly.
Change-Id: I8d52adf17392b7ac3a251eacde7a178c9633c247
---
M pywikibot/bot.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 2410708..722670e 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -905,7 +905,7 @@
choices = []
for name, choice in self._own_choices:
if getattr(self, 'allow_' + name):
- choices += [self._own_choices[name]]
+ choices += [choice]
if self.context_delta > 0:
choices += [HighlightContextOption(
'more context', 'm', self.current_text, self.context,
--
To view, visit https://gerrit.wikimedia.org/r/220733
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8d52adf17392b7ac3a251eacde7a178c9633c247
Gerrit-PatchSet: 1
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: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>