Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #3005
Status: Canceled
Duration: 10 hours, 57 minutes, and 54 seconds
Commit: 0e1e1bd (master)
Author: Fabian Neundorf
Message: [FIX] generate_user_files: Duplicated ERROR prefix
In a3765211 the prints were in the script were changed to `pywikibot.error` and
similar. One call was overlooked and continued to use the ERROR prefix in the
message. It also adds the exception message to that message so that it's
easier to figure out what went wrong.
Change-Id: I8ebc59d3cc65b0bec0e453e0a63b5d4bcef7bfff
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/cc4ac992d650...0e1e1bd3…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/84837635
--
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: [FEAT] plural_tests: Verify plural rules
......................................................................
[FEAT] plural_tests: Verify plural rules
This verifies the consistency of all plural rules. Static plural rules must
have `nplurals` set to 1 and return 0 for `plural`. If the plural is a callable
it'll test all values from 0 until `max_num` and check that the indexes
returned are greater than 0 but also below the number of plurals. That maximum
number thus must then cover all possible plurals for all languages.
Change-Id: If2a665fa047630de30ac51a108144affb08afa16
---
M tests/__init__.py
A tests/plural_tests.py
2 files changed, 76 insertions(+), 0 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/__init__.py b/tests/__init__.py
index 7a93711..5f3b16e 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -71,6 +71,7 @@
library_test_modules = [
'python',
+ 'plural',
'deprecation',
'ui',
'ui_options',
diff --git a/tests/plural_tests.py b/tests/plural_tests.py
new file mode 100644
index 0000000..dc1a2c1
--- /dev/null
+++ b/tests/plural_tests.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+"""Test plural module."""
+#
+# (C) Pywikibot team, 2015
+#
+# Distributed under the terms of the MIT license.
+#
+from __future__ import absolute_import, unicode_literals
+
+__version__ = '$Id$'
+
+from pywikibot import plural
+
+from tests.aspects import (
+ unittest, TestCase, MetaTestCaseClass,
+)
+from tests.utils import add_metaclass
+
+
+class MetaPluralRulesTest(MetaTestCaseClass):
+
+ """Metaclass to test each plural rule in separate tests."""
+
+ def __new__(cls, name, bases, dct):
+ """Create a new test case which tests all plural rules."""
+ def create_test(rule):
+ def test_static_rule(self):
+ """Test a rule which is just one integer."""
+ self.assertEqual(rule['nplurals'], 1)
+ self.assertEqual(rule['plural'], 0)
+
+ def test_callable_rule(self):
+ """Test a rule which is callable."""
+ # in theory a static rule could be also callable
+ self.assertGreater(rule['nplurals'], 0)
+ num_plurals = set()
+ for num in range(self.max_num + 1):
+ index = rule['plural'](num)
+ self.assertLess(index, rule['nplurals'],
+ msg='Plural for {0} created an index {1} '
+ '(greater than {2})'.format(num, index,
+ rule['nplurals']))
+ num_plurals.add(index)
+ self.assertCountEqual(num_plurals, list(range(rule['nplurals'])))
+
+ # Don't already fail on creation
+ if callable(rule.get('plural')):
+ return test_callable_rule
+ else:
+ return test_static_rule
+
+ for lang, rule in plural.plural_rules.items():
+ cls.add_method(dct, 'test_{0}'.format(lang), create_test(rule),
+ doc_suffix='for "{0}"'.format(lang))
+ return super(MetaPluralRulesTest, cls).__new__(cls, name, bases, dct)
+
+
+@add_metaclass
+class TestPluralRules(TestCase):
+
+ """Test the consistency of the plural rules."""
+
+ __metaclass__ = MetaPluralRulesTest
+
+ net = False
+ # for callable plural rules it'll test up until this number, this number
+ # must cause to create all plurals in all dynamic languages
+ max_num = 1000
+
+
+if __name__ == '__main__':
+ try:
+ unittest.main()
+ except SystemExit:
+ pass
--
To view, visit https://gerrit.wikimedia.org/r/244967
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If2a665fa047630de30ac51a108144affb08afa16
Gerrit-PatchSet: 5
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: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] generate_user_files: Duplicated ERROR prefix
......................................................................
[FIX] generate_user_files: Duplicated ERROR prefix
In a3765211 the prints were in the script were changed to `pywikibot.error` and
similar. One call was overlooked and continued to use the ERROR prefix in the
message. It also adds the exception message to that message so that it's
easier to figure out what went wrong.
Change-Id: I8ebc59d3cc65b0bec0e453e0a63b5d4bcef7bfff
---
M generate_user_files.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/generate_user_files.py b/generate_user_files.py
index a66bc2d..4455862 100755
--- a/generate_user_files.py
+++ b/generate_user_files.py
@@ -59,8 +59,8 @@
else:
try:
os.mkdir(new_base, pywikibot.config2.private_files_permission)
- except Exception:
- pywikibot.error("ERROR: directory creation failed")
+ except Exception as e:
+ pywikibot.error('directory creation failed: {0}'.format(e))
continue
pywikibot.output("Created new directory.")
break
--
To view, visit https://gerrit.wikimedia.org/r/245197
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8ebc59d3cc65b0bec0e453e0a63b5d4bcef7bfff
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 <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #3004
Status: Fixed
Duration: 1 hour, 9 minutes, and 6 seconds
Commit: cc4ac99 (master)
Author: Fabian Neundorf
Message: [IMPROV] Provide helper for generated tests
With 4ec75cd7 all tests which were generated using multiple sites are using
`__name__` now. But there are other cases which dynamically create tests and
may not add that property. So `MetaTestCaseClass` now supports `add_method`
which adds the value to the `dct` and sets `__name__` and allows to appends
something to a docstring (or to overwrite the docstring).
Change-Id: I7797ee461d82d764c32e92f773e9c7433fda24bd
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/4eb57a15abbf...cc4ac992…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/84826521
--
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: Add Python version to test apicache directory name
......................................................................
Add Python version to test apicache directory name
Python 3 can not load cache entries created by Python 2, resulting
in lots of warning messages when running tests on both versions.
This is most notable when tox runs tests for all version of Python.
Change-Id: Ic017663dae73926a931f92c1bc0ecc9f3921b664
---
M tests/__init__.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/__init__.py b/tests/__init__.py
index 631b7ce..7a93711 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -58,7 +58,8 @@
join_root_path.path = 'root'
join_tests_path = create_path_func(join_root_path, 'tests')
-join_cache_path = create_path_func(join_tests_path, 'apicache')
+join_cache_path = create_path_func(join_tests_path,
+ 'apicache-py%d' % PYTHON_VERSION[0])
join_data_path = create_path_func(join_tests_path, 'data')
join_pages_path = create_path_func(join_tests_path, 'pages')
--
To view, visit https://gerrit.wikimedia.org/r/244881
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic017663dae73926a931f92c1bc0ecc9f3921b664
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: touch.py: allow botflag tagging from cli
......................................................................
touch.py: allow botflag tagging from cli
Allow the operator to choose to use the 'b' flag.
Bug: T113450
Change-Id: I81c075ef14ad7c46917e138fb2be2aa248a74b54
---
M pywikibot/page.py
M scripts/touch.py
2 files changed, 11 insertions(+), 4 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 7f949fe..e296248 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1213,12 +1213,14 @@
"""
return self.site.purgepages([self], **kwargs)
- def touch(self, callback=None, **kwargs):
+ def touch(self, callback=None, botflag=False, **kwargs):
"""Make a touch edit for this page.
See save() method docs for all parameters.
The following parameters will be overridden by this method:
- summary, watch, minor, botflag, force, async
+ - summary, watch, minor, force, async
+
+ Parameter botflag is False by default.
minor and botflag parameters are set to False which prevents hiding
the edit when it becomes a real edit due to a bug.
@@ -1227,7 +1229,7 @@
# ensure always get the page text and not to change it.
del self.text
self.save(summary='Pywikibot touch edit', watch='nochange',
- minor=False, botflag=False, force=True, async=False,
+ minor=False, botflag=botflag, force=True, async=False,
callback=callback, apply_cosmetic_changes=False,
**kwargs)
else:
diff --git a/scripts/touch.py b/scripts/touch.py
index ccf92bf..c9162e2 100755
--- a/scripts/touch.py
+++ b/scripts/touch.py
@@ -11,6 +11,7 @@
¶ms;
-purge Do not touch but purge the page
+-botflag Force botflag in case of edits with changes.
"""
#
@@ -36,12 +37,15 @@
def __init__(self, generator, **kwargs):
"""Initialize a TouchBot instance with the options and generator."""
+ self.availableOptions.update({
+ 'botflag': False,
+ })
super(TouchBot, self).__init__(generator=generator, **kwargs)
def treat(self, page):
"""Touch the given page."""
try:
- page.touch()
+ page.touch(botflag=self.getOption('botflag'))
except pywikibot.NoPage:
pywikibot.error(u"Page %s does not exist."
% page.title(asLink=True))
@@ -88,6 +92,7 @@
pywikibot.output(u'-redirect option is deprecated, '
'do not use it anymore.')
elif not genFactory.handleArg(arg) and arg.startswith("-"):
+ # -botflag
options[arg[1:].lower()] = True
gen = genFactory.getCombinedGenerator()
--
To view, visit https://gerrit.wikimedia.org/r/240570
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I81c075ef14ad7c46917e138fb2be2aa248a74b54
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>