jenkins-bot has submitted this change and it was merged.
Change subject: Expect failure of scripts which fail dependencies
......................................................................
Expect failure of scripts which fail dependencies
Change-Id: I6d2ca1383ce92ef6e4a221e98b7abfb5b213b2d2
---
M tests/script_tests.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 7605708..ec9a8c0 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -181,7 +181,7 @@
for name in sorted(script_list)
if name != 'login'
and name not in deadlock_script_list
- and name not in failed_dep_script_list # no_args = execution
+ and name not in failed_dep_script_list
and name not in unrunnable_script_list
and (enable_autorun_tests or name not in auto_run_script_list)]
@@ -347,7 +347,7 @@
'data_ingestion', # bug 68611
'replicate_wiki', # bug 68664
'script_wui', # Failing on travis-ci
- ]:
+ ] + failed_dep_script_list:
dct[test_name] = unittest.expectedFailure(dct[test_name])
dct[test_name].__doc__ = 'Test running ' + script_name + ' -help'
dct[test_name].__name__ = test_name
@@ -377,7 +377,7 @@
'replicate_wiki', # custom return codes
'script_wui', # Error on any user except DrTrigonBot
'upload', # raises custom ValueError
- ] or (
+ ] + failed_dep_script_list or (
((config.family != 'wikipedia' or config.mylang != 'en') and script_name == 'cfd') or
(config.family == 'wikipedia' and script_name == 'disambredir') or
(config.family == 'wikipedia' and config.mylang != 'en' and script_name == 'misspelling')):
--
To view, visit https://gerrit.wikimedia.org/r/170680
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6d2ca1383ce92ef6e4a221e98b7abfb5b213b2d2
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: 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 <>
jenkins-bot has submitted this change and it was merged.
Change subject: Add default config for flickrripper
......................................................................
Add default config for flickrripper
Copied the config options from compat.
Moved handle_args to beginning of main(), so arguments are
parsed before missing flickr api key check can cause script
to fail. This allows -help to display even if the flickr
api key is not present.
Bug: 68606
Change-Id: I5320fc6df63fe9cdf233f63544119d339a4a3f8d
---
M pywikibot/config2.py
M scripts/flickrripper.py
M tests/script_tests.py
3 files changed, 14 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 18ea59c..4d74265 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -537,6 +537,16 @@
# http://www.bing.com/dev/en-us/dev-center
msn_appid = ''
+# ############# FLICKR RIPPER SETTINGS ##############
+
+# Using the Flickr api
+flickr = {
+ 'api_key': u'', # Provide your key!
+ 'api_secret': u'', # Api secret of your key (optional)
+ 'review': False, # Do we use automatically make our uploads reviewed?
+ 'reviewer': u'', # If so, under what reviewer name?
+}
+
# ############# COPYRIGHT SETTINGS ##############
# Enable/disable search engine in copyright.py script
diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py
index 514a15b..d1faf67 100644
--- a/scripts/flickrripper.py
+++ b/scripts/flickrripper.py
@@ -492,6 +492,8 @@
@param args: command line arguments
@type args: list of unicode
"""
+ local_args = pywikibot.handle_args(args)
+
# Get the api key
if not config.flickr['api_key']:
pywikibot.output('Flickr api key not found! Get yourself an api key')
@@ -541,7 +543,7 @@
# Should be renamed to overrideLicense or something like that
override = u''
- for arg in pywikibot.handle_args(args):
+ for arg in local_args:
if arg.startswith('-group_id'):
if len(arg) == 9:
group_id = pywikibot.input(u'What is the group_id of the pool?')
diff --git a/tests/script_tests.py b/tests/script_tests.py
index b46e647..7605708 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -345,7 +345,6 @@
dct[test_name] = test_execution(script_name, ['-help'])
if script_name in ['shell', 'version',
'data_ingestion', # bug 68611
- 'flickrripper', # bug 68606 (and others)
'replicate_wiki', # bug 68664
'script_wui', # Failing on travis-ci
]:
@@ -372,7 +371,7 @@
if script_name in ['catall', # stdout user interaction
'checkimages', # bug 68613
'data_ingestion', # bug 68611
- 'flickrripper', # bug 68606 (and deps)
+ 'flickrripper', # Requires a flickr api key
'lonelypages', # custom return codes
'nowcommons', # deprecation warning
'replicate_wiki', # custom return codes
--
To view, visit https://gerrit.wikimedia.org/r/170646
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5320fc6df63fe9cdf233f63544119d339a4a3f8d
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Link tests: Use unicode for é
......................................................................
[FIX] Link tests: Use unicode for é
Change-Id: Ifb7cde05e865dd44e8d6e3e1d6ba9e90de9d077a
---
M tests/link_tests.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/link_tests.py b/tests/link_tests.py
index f65781a..6cf9fb0 100644
--- a/tests/link_tests.py
+++ b/tests/link_tests.py
@@ -47,9 +47,9 @@
self.assertEqual(Link('Category:' + 'X' * 248).title, 'X' * 248)
self.assertEqual(Link('X' * 252).title, 'X' * 252)
self.assertEqual(Link('A%20B').title, 'A B')
- self.assertEqual(Link('A é B').title, 'A é B')
- self.assertEqual(Link('A é B').title, 'A é B')
- self.assertEqual(Link('A é B').title, 'A é B')
+ self.assertEqual(Link('A é B').title, u'A é B')
+ self.assertEqual(Link('A é B').title, u'A é B')
+ self.assertEqual(Link('A é B').title, u'A é B')
l = Link('A | B')
self.assertEqual(l.title, 'A')
--
To view, visit https://gerrit.wikimedia.org/r/170587
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb7cde05e865dd44e8d6e3e1d6ba9e90de9d077a
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 <>
jenkins-bot has submitted this change and it was merged.
Change subject: Remove flake8: noqa
......................................................................
Remove flake8: noqa
flake8: noqa disables all flakes in the module. 'noqa' should be
used to only disable flakes on the line it appears.
Change-Id: I2b9ba97f44176d2d8550951718599c32a3a58e88
---
M scripts/maintenance/cache.py
M setup.py
2 files changed, 31 insertions(+), 29 deletions(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/maintenance/cache.py b/scripts/maintenance/cache.py
index 603d50f..15dbc88 100644
--- a/scripts/maintenance/cache.py
+++ b/scripts/maintenance/cache.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-"""
+r"""
This script runs commands on each entry in the API caches.
Syntax: cache.py [-password] [-delete] [-c '...'] [dir ...]
@@ -53,15 +53,18 @@
import pywikibot
from pywikibot.data import api
-from pywikibot.site import APISite, DataSite, LoginStatus # flake8: noqa
-from pywikibot.page import User # flake8: noqa
+from pywikibot.site import APISite, DataSite, LoginStatus # noqa
+from pywikibot.page import User # noqa
class ParseError(Exception):
+
""" Error parsing. """
class CacheEntry(api.CachedRequest):
+
+ """A Request cache entry."""
def __init__(self, directory, filename):
""" Constructor. """
@@ -94,7 +97,6 @@
def parse_key(self):
""" Parse the key loaded from the cache entry. """
-
# find the start of the first parameter
start = self.key.index('(')
# find the end of the first object
@@ -171,20 +173,23 @@
os.remove(self._cachefile_path())
-def process_entries(cache_path, func):
- """ Check the contents of the cache. """
+def process_entries(cache_path, func, use_accesstime=None):
+ """
+ Check the contents of the cache.
- # This program tries to use file access times to determine
- # whether cache files are being used.
- # However file access times are not always usable.
- # On many modern filesystems, they have been disabled.
- # On unix, check the filesystem mount options. You may
- # need to remount with 'strictatime'.
- # - None = detect
- # - False = dont use
- # - True = always use
- use_accesstime = None
+ This program tries to use file access times to determine
+ whether cache files are being used.
+ However file access times are not always usable.
+ On many modern filesystems, they have been disabled.
+ On unix, check the filesystem mount options. You may
+ need to remount with 'strictatime'.
+ @param use_accesstime: Whether access times should be used.
+ @type use_accesstime: bool tristate:
+ - None = detect
+ - False = dont use
+ - True = always use
+ """
if not cache_path:
cache_path = os.path.join(pywikibot.config2.base_dir, 'apicache')
@@ -237,25 +242,25 @@
def has_password(entry):
- """ has a password in the entry """
+ """ Entry has a password in the entry. """
if 'lgpassword' in entry._uniquedescriptionstr():
return entry
def is_logout(entry):
- """ is a logout entry """
+ """ Entry is a logout entry. """
if not entry._data and 'logout' in entry.key:
return entry
def empty_response(entry):
- """ has no data """
+ """ Entry has no data. """
if not entry._data and 'logout' not in entry.key:
return entry
def not_accessed(entry):
- """ has never been accessed """
+ """ Entry has never been accessed. """
if not hasattr(entry, 'stinfo'):
return
diff --git a/setup.py b/setup.py
index 1baafb7..abc1e6b 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
-"""
-Installer script for Pywikibot 2.0 framework
-"""
+"""Installer script for Pywikibot 2.0 framework."""
#
# (C) Pywikibot team, 2009-2013
#
@@ -37,7 +35,7 @@
# however it is available with setuptools.
}
-dependency_links=[
+dependency_links = [
'https://git.wikimedia.org/zip/?r=pywikibot/externals/httplib2.git&format=gz…',
'git+https://github.com/AlereDevices/lunatic-python.git#egg=lunatic-python',
'git+https://github.com/jayvdb/parse-crontab.git#egg=crontab',
@@ -48,7 +46,7 @@
raise RuntimeError("ERROR: Pywikibot only runs under Python 2.6.5 or higher")
elif sys.version_info[1] == 6:
# work around distutils hardcoded unittest dependency
- import unittest # flake8: noqa
+ import unittest # noqa
if 'test' in sys.argv and sys.version_info < (2, 7):
import unittest2
sys.modules['unittest'] = unittest2
@@ -99,10 +97,9 @@
maintainer='The pywikibot team',
maintainer_email='pywikipedia-l(a)lists.wikimedia.org',
license='MIT License',
- packages=['pywikibot'] +
- [package
- for package in find_packages()
- if package.startswith('pywikibot.')],
+ packages=['pywikibot'] + [package
+ for package in find_packages()
+ if package.startswith('pywikibot.')],
install_requires=dependencies,
dependency_links=dependency_links,
extras_require=extra_deps,
--
To view, visit https://gerrit.wikimedia.org/r/170581
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2b9ba97f44176d2d8550951718599c32a3a58e88
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: 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 <>
jenkins-bot has submitted this change and it was merged.
Change subject: update current mw version
......................................................................
update current mw version
Change-Id: If8da28a29775164a5b49b4daa5eb03a2a086fa02
---
M family.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/family.py b/family.py
index d18b07e..c3e1b59 100644
--- a/family.py
+++ b/family.py
@@ -4326,7 +4326,7 @@
# Don't use this, use versionnumber() instead. This only exists
# to not break family files.
# Here we return the latest mw release for downloading
- return '1.23.5'
+ return '1.23.6'
def versionnumber(self, code, version=None):
"""Return an int identifying MediaWiki version.
--
To view, visit https://gerrit.wikimedia.org/r/170582
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If8da28a29775164a5b49b4daa5eb03a2a086fa02
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [FEAT] Advanced link tests
......................................................................
[FEAT] Advanced link tests
Applied link tests from:
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/master/tests%2Fqunit%2F…
Some tests done there are not valid for Link.parse, so they are
rewritten to test that the result is correct.
There three remaining failures where Link does accept the titles but
MediaWiki does not:
- Just ":" is not a valid link
- If the title contains a section and a namespace prefix but no title it
should be invalid (as it is already working when there is no section)
- If the (non-)talk page of the title is actually a title in another
namespace.
Example: Talk:File:Test.png would've the non-talk page File:Test.png
but it's talk page would be File talk:Test.png
Bug: 72681
Change-Id: Iaccbc228876cd6053426fd702fd2e5c620581f79
---
M tests/link_tests.py
1 file changed, 88 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/link_tests.py b/tests/link_tests.py
index 0e37551..f65781a 100644
--- a/tests/link_tests.py
+++ b/tests/link_tests.py
@@ -11,7 +11,94 @@
from pywikibot import config2 as config
from pywikibot.page import Link
from pywikibot.exceptions import Error, InvalidTitle
-from tests.aspects import unittest, TestCase
+from tests.aspects import unittest, DefaultDrySiteTestCase, TestCase
+
+
+# ---- Tests checking if the parser does (not) accept (in)valid titles
+
+
+class TestLink(DefaultDrySiteTestCase):
+
+ """
+ Test parsing links with DrySite.
+
+ The DrySite is using the builtin namespaces which behaviour is controlled
+ in this repository so namespace aware tests do work, even when the actual
+ default site is using completely different namespaces.
+ """
+
+ def test_valid(self):
+ self.assertEqual(Link('Sandbox').title, 'Sandbox')
+ self.assertEqual(Link('A "B"').title, 'A "B"')
+ self.assertEqual(Link('A \'B\'').title, 'A \'B\'')
+ self.assertEqual(Link('.com').title, '.com')
+ self.assertEqual(Link('~').title, '~')
+ self.assertEqual(Link('"').title, '"')
+ self.assertEqual(Link('\'').title, '\'')
+ self.assertEqual(Link('Talk:Sandbox').title, 'Sandbox')
+ self.assertEqual(Link('Talk:Foo:Sandbox').title, 'Foo:Sandbox')
+ self.assertEqual(Link('File:Example.svg').title, 'Example.svg')
+ self.assertEqual(Link('File_talk:Example.svg').title, 'Example.svg')
+ self.assertEqual(Link('Foo/.../Sandbox').title, 'Foo/.../Sandbox')
+ self.assertEqual(Link('Sandbox/...').title, 'Sandbox/...')
+ self.assertEqual(Link('A~~').title, 'A~~')
+ self.assertEqual(Link(':A').title, 'A')
+ # Length is 256 total, but only title part matters
+ self.assertEqual(Link('Category:' + 'X' * 248).title, 'X' * 248)
+ self.assertEqual(Link('X' * 252).title, 'X' * 252)
+ self.assertEqual(Link('A%20B').title, 'A B')
+ self.assertEqual(Link('A é B').title, 'A é B')
+ self.assertEqual(Link('A é B').title, 'A é B')
+ self.assertEqual(Link('A é B').title, 'A é B')
+
+ l = Link('A | B')
+ self.assertEqual(l.title, 'A')
+ self.assertEqual(l.anchor, ' B')
+
+ l = Link('A%23B')
+ self.assertEqual(l.title, 'A')
+ self.assertEqual(l.section, 'B')
+
+ def test_invalid(self):
+ self.assertRaises(InvalidTitle, Link('').parse)
+ # TODO: self.assertRaises(InvalidTitle, Link(':').parse)
+ self.assertRaises(InvalidTitle, Link('__ __').parse)
+ self.assertRaises(InvalidTitle, Link(' __ ').parse)
+ # Bad characters forbidden regardless of wgLegalTitleChars
+ self.assertRaises(InvalidTitle, Link('A [ B').parse)
+ self.assertRaises(InvalidTitle, Link('A ] B').parse)
+ self.assertRaises(InvalidTitle, Link('A { B').parse)
+ self.assertRaises(InvalidTitle, Link('A } B').parse)
+ self.assertRaises(InvalidTitle, Link('A < B').parse)
+ self.assertRaises(InvalidTitle, Link('A > B').parse)
+ # URL encoding
+ # %XX is understood by wikimedia but not %XXXX
+ self.assertRaises(InvalidTitle, Link('A%2523B').parse)
+ # Subject of NS_TALK does not roundtrip to NS_MAIN
+ # TODO: A link is invalid if their (non-)talk page would be in another
+ # namespace than the link's "other" namespace
+ # TODO: self.assertRaises(InvalidTitle, Link('Talk:File:Example.svg').parse)
+ # Directory navigation
+ self.assertRaises(InvalidTitle, Link('.').parse)
+ self.assertRaises(InvalidTitle, Link('..').parse)
+ self.assertRaises(InvalidTitle, Link('./Sandbox').parse)
+ self.assertRaises(InvalidTitle, Link('../Sandbox').parse)
+ self.assertRaises(InvalidTitle, Link('Foo/./Sandbox').parse)
+ self.assertRaises(InvalidTitle, Link('Foo/../Sandbox').parse)
+ self.assertRaises(InvalidTitle, Link('Sandbox/.').parse)
+ self.assertRaises(InvalidTitle, Link('Sandbox/..').parse)
+ # Tilde
+ self.assertRaises(InvalidTitle, Link('A ~~~ Name').parse)
+ self.assertRaises(InvalidTitle, Link('A ~~~~ Signature').parse)
+ self.assertRaises(InvalidTitle, Link('A ~~~~~ Timestamp').parse)
+ # Overlength
+ self.assertRaises(InvalidTitle, Link('x' * 256).parse)
+ self.assertRaises(InvalidTitle, Link('Invalid:' + 'X' * 248).parse)
+ # Namespace prefix without actual title
+ self.assertRaises(InvalidTitle, Link('Talk:').parse)
+ self.assertRaises(InvalidTitle, Link('Category: ').parse)
+ # TODO: self.assertRaises(InvalidTitle, Link('Category: #bar').parse)
+
# ---- The first set of tests are explicit links, starting with a ':'.
--
To view, visit https://gerrit.wikimedia.org/r/170577
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaccbc228876cd6053426fd702fd2e5c620581f79
Gerrit-PatchSet: 3
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 <>