jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/555722 )
Change subject: [tests] Make T240060 deviation a separate test
......................................................................
[tests] Make T240060 deviation a separate test
Bug: T240060
Change-Id: I62c3b5ce8f80c8c81ec89ad0765edf6de6ea867c
---
M tests/tools_ip_tests.py
1 file changed, 15 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/tools_ip_tests.py b/tests/tools_ip_tests.py
index 2585091..88cd474 100644
--- a/tests/tools_ip_tests.py
+++ b/tests/tools_ip_tests.py
@@ -9,7 +9,7 @@
from distutils.version import StrictVersion
-from pywikibot.tools import ip, PY2
+from pywikibot.tools import ip, PY2, PYTHON_VERSION
from tests import unittest_print
from tests.aspects import unittest, TestCase, DeprecationTestCase
@@ -214,12 +214,6 @@
self.ipv6test(False, '1.2.3.4::')
# Testing IPv4 addresses represented as dotted-quads
- # Leading zero's in IPv4 addresses not allowed: some systems treat the
- # leading "0" in ".086" as the start of an octal number
- # Update: The BNF in RFC-3986 explicitly defines the dec-octet
- # (for IPv4 addresses) not to have a leading zero
- self.ipv6test(False, 'fe80:0000:0000:0000:0204:61ff:254.157.241.086')
- # but this is OK, since there's a single digit
self.ipv6test(True, '::ffff:192.0.2.128')
self.ipv6test(False, 'XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:1.2.3.4')
self.ipv6test(False, '1111:2222:3333:4444:5555:6666:256.256.256.256')
@@ -654,6 +648,16 @@
# extra 0 not allowed!
self.ipv6test(False, '2001:0000:1234:0000:00001:C1C0:ABCD:0876')
+ def _test_T240060_failures(self):
+ """Test known deviated behaviour in Python 3.8."""
+ # Testing IPv4 addresses represented as dotted-quads
+ # Leading zero's in IPv4 addresses not allowed: some systems treat the
+ # leading "0" in ".086" as the start of an octal number
+ # Update: The BNF in RFC-3986 explicitly defines the dec-octet
+ # (for IPv4 addresses) not to have a leading zero
+ self.ipv6test(PYTHON_VERSION >= (3, 8),
+ 'fe80:0000:0000:0000:0204:61ff:254.157.241.086')
+
class IPRegexTestCase(TestIPBase, DeprecationTestCase):
@@ -702,6 +706,10 @@
"""Test known bugs in the ipaddr module."""
self._test_T105443_failures()
+ def test_T240060_failures(self):
+ """Test known bugs in the ipaddr module."""
+ self._test_T240060_failures()
+
if __name__ == '__main__': # pragma: no cover
try:
--
To view, visit https://gerrit.wikimedia.org/r/555722
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I62c3b5ce8f80c8c81ec89ad0765edf6de6ea867c
Gerrit-Change-Number: 555722
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/557510 )
Change subject: [bugfix] Test for existing users for wikipedia family only
......................................................................
[bugfix] Test for existing users for wikipedia family only
- user in userlist are not expected outside wikipedia family;
change TestUserList.test_users accordingly
- use subTest to verify all users
- use enumerate for cnt counter
Bug: T240059
Change-Id: I3cb20ead1e1a9c50c6221114dd28a096a40082a9
---
M tests/site_tests.py
1 file changed, 8 insertions(+), 9 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py
index d700c51..63b532a 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -2146,15 +2146,14 @@
user_list = ['Jimbo Wales', 'Brion VIBBER', 'Tim Starling']
missing = ['A username that should not exist 1A53F6E375B5']
all_users = user_list + missing
- cnt = 0
- for user in self.site.users(all_users):
- self.assertIsInstance(user, dict)
- self.assertIn(user['name'], all_users)
- if user['name'] == missing[0]:
- self.assertIn('missing', user)
- else:
- self.assertNotIn('missing', user)
- cnt += 1
+ for cnt, user in enumerate(self.site.users(all_users), start=1):
+ with self.subTest(user=user['name']):
+ self.assertIsInstance(user, dict)
+ self.assertIn(user['name'], all_users)
+ if user['name'] == missing[0]:
+ self.assertIn('missing', user)
+ elif self.site.family.name == 'wikipedia':
+ self.assertNotIn('missing', user)
self.assertEqual(cnt, len(all_users), 'Some test usernames not found')
--
To view, visit https://gerrit.wikimedia.org/r/557510
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I3cb20ead1e1a9c50c6221114dd28a096a40082a9
Gerrit-Change-Number: 557510
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/558542 )
Change subject: [IMPR] Avoid deeply nested flow statements
......................................................................
[IMPR] Avoid deeply nested flow statements
continue loop instead of indenting if-statement
Change-Id: I5f2ca921203119174fc094a0d9b5d8a965e6ffb3
---
M scripts/imagecopy.py
1 file changed, 54 insertions(+), 53 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py
index 07e819a..b31c3db 100644
--- a/scripts/imagecopy.py
+++ b/scripts/imagecopy.py
@@ -523,66 +523,67 @@
load_global_archivo()
for page in pregenerator:
+ if not page.exists() or page.namespace() != 6 or page.isRedirectPage():
+ continue
+
skip = False
- if page.exists() and page.namespace() == 6 \
- and not page.isRedirectPage():
- imagepage = pywikibot.FilePage(page.site, page.title())
+ imagepage = pywikibot.FilePage(page.site, page.title())
- # First do autoskip.
- if doiskip(imagepage.get()):
- pywikibot.output('Skipping ' + page.title())
- skip = True
+ # First do autoskip.
+ if doiskip(imagepage.get()):
+ pywikibot.output('Skipping ' + page.title())
+ skip = True
+ else:
+ # The first upload is last in the list.
+ try:
+ username = imagepage.latest_file_info.user
+ except NotImplementedError:
+ # No API, using the page file instead
+ (datetime, username, resolution, size,
+ comment) = imagepage.get_file_history().pop()
+ if always:
+ newname = imagepage.title(with_ns=False)
+ CommonsPage = pywikibot.Page(pywikibot.Site('commons',
+ 'commons'),
+ 'File:' + newname)
+ if CommonsPage.exists():
+ skip = True
else:
- # The first upload is last in the list.
- try:
- username = imagepage.latest_file_info.user
- except NotImplementedError:
- # No API, using the page file instead
- (datetime, username, resolution, size,
- comment) = imagepage.get_file_history().pop()
- if always:
- newname = imagepage.title(with_ns=False)
- CommonsPage = pywikibot.Page(pywikibot.Site('commons',
- 'commons'),
- 'File:' + newname)
- if CommonsPage.exists():
- skip = True
- else:
- while True:
- # Do TkdialogIC to accept/reject and change the name
- newname, skip = TkdialogIC(
- imagepage.title(with_ns=False),
- imagepage.get(), username,
- imagepage.permalink(with_protocol=True),
- imagepage.templates()).getnewname()
+ while True:
+ # Do TkdialogIC to accept/reject and change the name
+ newname, skip = TkdialogIC(
+ imagepage.title(with_ns=False),
+ imagepage.get(), username,
+ imagepage.permalink(with_protocol=True),
+ imagepage.templates()).getnewname()
- if skip:
- pywikibot.output('Skipping this image')
- break
+ if skip:
+ pywikibot.output('Skipping this image')
+ break
- # Did we enter a new name?
- if len(newname) == 0:
- # Take the old name
- newname = imagepage.title(with_ns=False)
- else:
- newname = newname.decode('utf-8')
+ # Did we enter a new name?
+ if len(newname) == 0:
+ # Take the old name
+ newname = imagepage.title(with_ns=False)
+ else:
+ newname = newname.decode('utf-8')
- # Check if the image already exists
- CommonsPage = pywikibot.Page(
- imagepage.site.image_repository(),
- 'File:' + newname)
- if not CommonsPage.exists():
- break
- else:
- pywikibot.output(
- 'Image already exists, pick another name or '
- 'skip this image')
- # We don't overwrite images, pick another name, go to
- # the start of the loop
+ # Check if the image already exists
+ CommonsPage = pywikibot.Page(
+ imagepage.site.image_repository(),
+ 'File:' + newname)
+ if not CommonsPage.exists():
+ break
+ else:
+ pywikibot.output(
+ 'Image already exists, pick another name or '
+ 'skip this image')
+ # We don't overwrite images, pick another name, go to
+ # the start of the loop
- if not skip:
- imageTransfer(imagepage, newname, category,
- delete_after_done).start()
+ if not skip:
+ imageTransfer(imagepage, newname, category,
+ delete_after_done).start()
pywikibot.output('Still ' + str(threading.activeCount())
+ ' active threads, lets wait')
--
To view, visit https://gerrit.wikimedia.org/r/558542
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5f2ca921203119174fc094a0d9b5d8a965e6ffb3
Gerrit-Change-Number: 558542
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/557517 )
Change subject: [doc] Update HISTORY.rst
......................................................................
[doc] Update HISTORY.rst
Change-Id: I6ff7dd496bc0af3e182d2607033eaf7a8622f336
---
M HISTORY.rst
1 file changed, 13 insertions(+), 1 deletion(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index 27968bc..8c82a40 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,7 +4,19 @@
Current release
---------------
-* enum34 package is mandatory for Python 2.7
+* replaceCategoryInPlace: Allow LRM and RLM at the end of the old_cat title (T240084)
+* Support for Python 3.4 will be dropped (T239542)
+* Derive LoginStatus from IntEnum (T213287, T239533)
+* enum34 package is mandatory for Python 2.7 (T213287)
+* call LoginManager with keyword arguments (T237501)
+* Enable Pywikibot for Python 3.8 (T238637)
+* Derive BaseLink from tools.UnicodeMixin (T223894)
+* Make _flush aware of _putthread ongoing tasks (T147178)
+* Add family file for foundation wiki (T237888)
+* Fix generate_family_file.py for private wikis (T235768)
+* Add rank parameter to Claim initializer
+* Add current directory for similar script search (T217195)
+* Release BaseSite.lock_page mutex during sleep
* Implement deletedrevisions api call (T75370)
* assert_valid_iter_params may raise AssertionError instead of pywikibot.Error (T233582)
* Upcast getRedirectTarget result and return the appropriate page subclass (T233392)
--
To view, visit https://gerrit.wikimedia.org/r/557517
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6ff7dd496bc0af3e182d2607033eaf7a8622f336
Gerrit-Change-Number: 557517
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/555727 )
Change subject: [bugfix] Ensure that required props exists as Page attribute
......................................................................
[bugfix] Ensure that required props exists as Page attribute
If page attributes langlinks or templates are required
ensure that api.update_page creates them as empty lists
even the api does not have them.
This also solves test_preload_templates_and_langlinks
and test_preload_templates failures.
Bug: T237497
Change-Id: I3bb5d8e2046006ed1e262dd9618b0407ee91dae7
---
M pywikibot/data/api.py
M tests/site_tests.py
2 files changed, 10 insertions(+), 15 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 05b15ca..4ae1892 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -3333,9 +3333,13 @@
if 'templates' in pagedict:
_update_templates(page, pagedict['templates'])
+ elif 'templates' in props:
+ page._templates = []
if 'langlinks' in pagedict:
_update_langlinks(page, pagedict['langlinks'])
+ elif 'langlinks' in props:
+ page._langlinks = []
if 'coordinates' in pagedict:
_update_coordinates(page, pagedict['coordinates'])
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 188b0f4..b4fbfd0 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -3265,7 +3265,7 @@
break
def test_preload_langlinks_normal(self):
- """Test preloading continuation works."""
+ """Test preloading langlinks works."""
mysite = self.get_site()
links = mysite.pagelinks(self.get_mainpage(), total=10)
gen = mysite.preloadpages(links, groupsize=5, langlinks=True)
@@ -3318,22 +3318,14 @@
if count >= 5:
break
- @unittest.expectedFailure
def test_preload_templates_and_langlinks(self):
"""Test preloading templates and langlinks works."""
mysite = self.get_site()
- mainpage = self.get_mainpage()
- count = 0
# Use backlinks, as any backlink has at least one link
- links = mysite.pagebacklinks(mainpage, total=10)
- # Screen pages before test;
- # it is not guaranteed that all pages will have both.
- links = [l for l in links if (l.langlinks() and l.templates())]
- # Skip test if no valid pages are found.
- if not links:
- self.skipTest('No valid pages found to carry out test.')
-
- for page in mysite.preloadpages(links, langlinks=True, templates=True):
+ links = mysite.pagebacklinks(self.get_mainpage(), total=10)
+ for count, page in enumerate(mysite.preloadpages(links,
+ langlinks=True,
+ templates=True)):
with self.subTest(page=page):
self.assertIsInstance(page, pywikibot.Page)
self.assertIsInstance(page.exists(), bool)
@@ -3343,8 +3335,7 @@
self.assertFalse(hasattr(page, '_pageprops'))
self.assertTrue(hasattr(page, '_templates'))
self.assertTrue(hasattr(page, '_langlinks'))
- count += 1
- if count >= 6:
+ if count >= 5:
break
--
To view, visit https://gerrit.wikimedia.org/r/555727
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I3bb5d8e2046006ed1e262dd9618b0407ee91dae7
Gerrit-Change-Number: 555727
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)