jenkins-bot has submitted this change and it was merged.
Change subject: [IMPR] remove superfluous assignment to a instance variable
......................................................................
[IMPR] remove superfluous assignment to a instance variable
self.hiddentemplates is a instance variable which might be expanded
in loadHiddenTemplates() method. A reassignment is not necessary.
Change-Id: I79bad15e6000c83d3b5f5249d68bc1d3c78edf77
---
M scripts/checkimages.py
1 file changed, 1 insertion(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
XZise: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index ffaf9d0..85cd5a0 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -867,7 +867,6 @@
for element in self.load(pageHiddenText):
self.hiddentemplates.add(pywikibot.Page(self.site, element))
- return self.hiddentemplates
def returnOlderTime(self, listGiven, timeListGiven):
"""Get some time and return the oldest of them."""
@@ -1321,7 +1320,7 @@
regex_are_licenses = re.compile(
r'(?<!\{)\{\{(?:[Tt]emplate:|)([^{]+?)\}\}', re.DOTALL)
while True:
- self.hiddentemplates = self.loadHiddenTemplates()
+ self.loadHiddenTemplates()
self.licenses_found = self.image.templates()
templatesInTheImageRaw = regex_find_licenses.findall(
self.imageCheckText)
--
To view, visit https://gerrit.wikimedia.org/r/234593
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I79bad15e6000c83d3b5f5249d68bc1d3c78edf77
Gerrit-PatchSet: 2
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: 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: [IMPROV] site_tests: Separate deprecated calls
......................................................................
[IMPROV] site_tests: Separate deprecated calls
The property `nocapitalize` and method `case()` of `APISite` have been
deprecated but this wasn't tested. The test of the `case()` method has been
moved and asserts the deprecation while a new test for `nocapitalize` has been
added.
It also fixed the //instead// string of `case()` which was also adding //use//.
Change-Id: I0285fe24835c2e761092a0aa5379451c06ce10be
---
M pywikibot/site.py
M tests/site_tests.py
2 files changed, 16 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 3f3fe9f..665318b 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2411,7 +2411,7 @@
"""Site information dict."""
return self._siteinfo
- @deprecated('use siteinfo or Namespace instance')
+ @deprecated('siteinfo or Namespace instance')
def case(self):
"""Return this site's capitalization rule."""
# This is the global setting via $wgCapitalLinks, it is used whenever
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 5b23525..2bd3e14 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -77,6 +77,17 @@
cached = True
+ def test_capitalization(self):
+ """Test that the case method is mirroring the siteinfo."""
+ self.assertEqual(self.site.case(), self.site.siteinfo['case'])
+ self.assertOneDeprecationParts('pywikibot.site.BaseSite.case',
+ 'siteinfo or Namespace instance')
+ self.assertIs(self.site.nocapitalize,
+ self.site.siteinfo['case'] == 'case-sensitive')
+ self.assertOneDeprecationParts(
+ 'pywikibot.site.BaseSite.nocapitalize',
+ "APISite.siteinfo['case'] or Namespace.case == 'case-sensitive'")
+
def test_live_version(self):
"""Test live_version."""
mysite = self.get_site()
@@ -224,7 +235,10 @@
self.assertIsInstance(dabcat, pywikibot.Category)
foo = unicode(pywikibot.Link("foo", source=mysite))
- self.assertEqual(foo, u"[[foo]]" if mysite.nocapitalize else u"[[Foo]]")
+ if self.site.namespaces[0].case == 'case-sensitive':
+ self.assertEqual(foo, '[[foo]]')
+ else:
+ self.assertEqual(foo, '[[Foo]]')
self.assertFalse(mysite.isInterwikiLink("foo"))
self.assertIsInstance(mysite.redirectRegex().pattern, basestring)
@@ -1895,7 +1909,6 @@
datetime.strptime(mysite.siteinfo['time'], '%Y-%m-%dT%H:%M:%SZ'),
datetime)
self.assertIn(mysite.siteinfo['case'], ["first-letter", "case-sensitive"])
- self.assertEqual(mysite.case(), mysite.siteinfo['case'])
self.assertEqual(re.findall("\$1", mysite.siteinfo['articlepath']), ["$1"])
def test_properties_with_defaults(self):
--
To view, visit https://gerrit.wikimedia.org/r/234812
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0285fe24835c2e761092a0aa5379451c06ce10be
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: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] tests: Check site's path availability
......................................................................
[FIX] tests: Check site's path availability
The tests do a simple hostname check before doing a test, but when the hostname
itself is not available but the wiki path it would skip the tests. This is also
using the HEAD method to just check the theoretical availability.
Change-Id: Iee082c12744b1da420903f30177324305f5f65b8
---
M tests/aspects.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/aspects.py b/tests/aspects.py
index 720a1d3..7897601 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -492,13 +492,13 @@
if '://' not in hostname:
hostname = 'http://' + hostname
r = http.fetch(uri=hostname,
+ method='HEAD',
default_error_handling=False)
if r.exception:
e = r.exception
else:
if r.status not in [200, 301, 302, 303, 307, 308]:
raise ServerError('HTTP status: %d' % r.status)
- r.content # default decode may raise exception
except Exception as e2:
pywikibot.error('%s: accessing %s caused exception:'
% (cls.__name__, hostname))
@@ -888,7 +888,7 @@
interface=interface)
if 'hostname' not in data and 'site' in data:
try:
- data['hostname'] = data['site'].hostname()
+ data['hostname'] = data['site'].base_url(data['site'].path())
except KeyError:
# The family has defined this as obsolete
# without a mapping to a hostname.
--
To view, visit https://gerrit.wikimedia.org/r/234810
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iee082c12744b1da420903f30177324305f5f65b8
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: jenkins-bot <>