jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/234421 )
Change subject: Replace deprecated 'nocapitalize' in interwiki.py
......................................................................
Replace deprecated 'nocapitalize' in interwiki.py
While processing pages in Wiktionaries, when langlinks differed
from page title only in capitalization, a DeprecationWarning was
issued regarding the use of obsolete property BaseSite.nocapitalize.
Change-Id: I0e2e3822601257cb3b741d92971e071d73ba635c
---
M scripts/interwiki.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 7b4f5bc..bc4af48 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -1125,8 +1125,8 @@
% (page, self.originPage))
return True
elif (page.title() != self.originPage.title() and
- self.originPage.site.nocapitalize and
- page.site.nocapitalize):
+ self.originPage.namespace().case == 'case-sensitive' and
+ page.namespace().case == 'case-sensitive'):
pywikibot.output(
u"NOTE: Ignoring %s for %s in wiktionary mode because both "
u"languages are uncapitalized."
--
To view, visit https://gerrit.wikimedia.org/r/234421
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0e2e3822601257cb3b741d92971e071d73ba635c
Gerrit-PatchSet: 5
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <gerritpatchuploader(a)gmail.com>
Gerrit-Reviewer: Gerrit Patch Uploader <gerritpatchuploader(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <Ladsgroup(a)gmail.com>
Gerrit-Reviewer: Malafaya <malafaya(a)clix.pt>
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. ( https://gerrit.wikimedia.org/r/349790 )
Change subject: config2.py: Increase the default socket_timeout to 75 seconds
......................................................................
config2.py: Increase the default socket_timeout to 75 seconds
Bug: T163635
Change-Id: Ie0c24aa7831cdd1679afef3ee4f43a681a932538
---
M pywikibot/config2.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index e0bac1e..fd5a2df 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -783,7 +783,7 @@
# DO NOT set to None to disable timeouts. Otherwise this may freeze your script.
# You may assign either a tuple of two int or float values for connection and
# read timeout, or a single value for both in a tuple (since requests 2.4.0).
-socket_timeout = 30
+socket_timeout = 75
# ############# COSMETIC CHANGES SETTINGS ##############
--
To view, visit https://gerrit.wikimedia.org/r/349790
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0c24aa7831cdd1679afef3ee4f43a681a932538
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/349736 )
Change subject: site_tests.py: Use datetime.utcnow() instead of datetime.now()
......................................................................
site_tests.py: Use datetime.utcnow() instead of datetime.now()
Also:
- Move the test to an uncached class. Due to the time-dependant nature
of the test, the cached response could cause the test to fail in some
cases.
- Increase the time buffer to 30 minutes, this is to make sure the
item has not been connected recently.
- Print the related `item` in the error message which will be
helpful in debugging.
Bug: T163619
Change-Id: I4f6e2684173bd465a423c75c5442595df019d73e
---
M tests/site_tests.py
1 file changed, 33 insertions(+), 28 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/tests/site_tests.py b/tests/site_tests.py
index ba943c1..07c1b1a 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -966,34 +966,6 @@
self.assertNotIn(page.protection()['edit'][0], invalid_levels)
self.assertLessEqual(len(pages), 10)
- def test_unconnected(self):
- """Test that the ItemPage returned raises NoPage."""
- if not self.site.data_repository():
- raise unittest.SkipTest('Site is not using a Wikibase repository')
- if self.site.hostname() == 'test.wikipedia.org':
- raise unittest.SkipTest('test.wikipedia is misconfigured; T85358')
- cnt = 0
- start_time = datetime.now() - timedelta(minutes=5)
- # Pages which have been connected recently may still be reported as
- # unconnected. So try on an version that is a few minutes older if the
- # tested site appears as a sitelink.
- for page in self.site.unconnected_pages(total=5):
- try:
- item = pywikibot.ItemPage.fromPage(page)
- except pywikibot.NoPage:
- pass
- else:
- revisions = list(item.revisions(total=1, starttime=start_time,
- content=True))
- if revisions:
- sitelinks = json.loads(revisions[0].text)['sitelinks']
- self.assertNotIn(
- self.site.dbName(), sitelinks,
- 'Page "{0}" is connected to a Wikibase '
- 'repository'.format(page.title()))
- cnt += 1
- self.assertLessEqual(cnt, 5)
-
def test_pages_with_property(self):
"""Test pages_with_property method."""
if MediaWikiVersion(self.site.version()) < MediaWikiVersion('1.21'):
@@ -1015,6 +987,39 @@
'NotImplementedError not raised for {0}'.format(item))
+class TestSiteGeneratorsUncached(DefaultSiteTestCase):
+
+ """Test cases for Site methods."""
+
+ def test_unconnected(self):
+ """Test that the ItemPage returned raises NoPage."""
+ if not self.site.data_repository():
+ raise unittest.SkipTest('Site is not using a Wikibase repository')
+ if self.site.hostname() == 'test.wikipedia.org':
+ raise unittest.SkipTest('test.wikipedia is misconfigured; T85358')
+ cnt = 0
+ # Pages which have been connected recently may still be reported as
+ # unconnected. So try on a version that is a few minutes older if the
+ # tested site appears as a sitelink.
+ start_time = datetime.utcnow() - timedelta(minutes=30)
+ for page in self.site.unconnected_pages(total=3):
+ try:
+ item = pywikibot.ItemPage.fromPage(page)
+ except pywikibot.NoPage:
+ pass
+ else:
+ revisions = list(item.revisions(total=1, starttime=start_time,
+ content=True))
+ if revisions:
+ sitelinks = json.loads(revisions[0].text)['sitelinks']
+ self.assertNotIn(
+ self.site.dbName(), sitelinks,
+ 'Page "{0}" is connected to {1} on Wikibase '
+ 'repository'.format(page.title(), item))
+ cnt += 1
+ self.assertLessEqual(cnt, 3)
+
+
class TestImageUsage(DefaultSiteTestCase):
"""Test cases for Site.imageusage method."""
--
To view, visit https://gerrit.wikimedia.org/r/349736
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4f6e2684173bd465a423c75c5442595df019d73e
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>