jenkins-bot has submitted this change and it was merged.
Change subject: 45 typo fixes
......................................................................
45 typo fixes
* 15 occurence → occurrence
* 15 occurences → occurrences
* 4 insenstive → insensitive
* 4 overriden → overridden
* 2 return a the → return the
* 2 splitted → split
* 1 chache → cache
* 1 generator which yield → generator which yields
* 1 langauge → language
Change-Id: I960e5e8dc107f3f1d3eb59a5088f4fc73aa1b191
---
M pywikibot/__init__.py
M pywikibot/bot.py
M pywikibot/config2.py
M pywikibot/editor.py
M pywikibot/i18n.py
M pywikibot/logentries.py
M pywikibot/site.py
M pywikibot/textlib.py
M pywikibot/userinterfaces/gui.py
M pywikibot/userinterfaces/terminal_interface_base.py
M pywikibot/version.py
M scripts/category.py
M scripts/commonscat.py
M scripts/image.py
M scripts/noreferences.py
M scripts/nowcommons.py
M scripts/protect.py
M scripts/replace.py
M scripts/replicate_wiki.py
M scripts/solve_disambiguation.py
M scripts/template.py
M scripts/upload.py
M tests/__init__.py
M tests/i18n_tests.py
M tests/site_tests.py
25 files changed, 45 insertions(+), 45 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index feee966..2e32da1 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -513,7 +513,7 @@
Site objects are cached and reused by this method.
- By default rely on config settings. These defaults may all be overriden
+ By default rely on config settings. These defaults may all be overridden
using the method parameters.
@param code: language code (override config.mylang)
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 5ac275f..8643081 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -899,7 +899,7 @@
@param kwargs: options
@type kwargs: dict
"""
- # contains the options overriden from defaults
+ # contains the options overridden from defaults
self.options = {}
validOptions = set(self.availableOptions)
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index c9bc252..2a2be84 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -677,7 +677,7 @@
# 'wikipedia:li': {'Hoofdpagina': 'Veurblaad'}
# }
#
-# to replace all occurences of 'Hoofdpagina' with 'Veurblaad' when writing to
+# to replace all occurrences of 'Hoofdpagina' with 'Veurblaad' when writing to
# liwiki. Note that this does not take the origin wiki into account.
replicate_replace = {}
diff --git a/pywikibot/editor.py b/pywikibot/editor.py
index 0243717..1f877e3 100644
--- a/pywikibot/editor.py
+++ b/pywikibot/editor.py
@@ -27,8 +27,8 @@
"""Return editor selected in user-config.py."""
command = config.editor
if jumpIndex:
- # Some editors make it possible to mark occurences of substrings,
- # or to jump to the line of the first occurence.
+ # Some editors make it possible to mark occurrences of substrings,
+ # or to jump to the line of the first occurrence.
# TODO: Find a better solution than hardcoding these, e.g. a config
# option.
line = text[:jumpIndex].count('\n')
@@ -83,7 +83,7 @@
@type text: unicode
@param jumpIndex: position at which to put the caret
@type jumpIndex: int
- @param highlight: each occurence of this substring will be highlighted
+ @param highlight: each occurrence of this substring will be highlighted
@type highlight: unicode
@return: the modified text, or None if the user didn't save the text
file in his text editor
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 23f218e..6b0dede 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -250,7 +250,7 @@
if len(plural_items) > 1 and isinstance(parameters, (tuple, list)) and \
len(plural_items) != len(parameters):
raise ValueError("Length of parameter does not match PLURAL "
- "occurences.")
+ "occurrences.")
i = 0
for selector, variants in plural_items:
if isinstance(parameters, dict):
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index 8bfb0a6..750279b 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -34,7 +34,7 @@
# Log type expected. None for every type, or one of the (letype) str :
# block/patrol/etc...
- # Overriden in subclasses.
+ # Overridden in subclasses.
_expectedType = None
def __init__(self, apidata, site):
diff --git a/pywikibot/site.py b/pywikibot/site.py
index e0f4b49..66cc068 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -285,11 +285,11 @@
return u'' + name + u':'
def __str__(self):
- """Return a the canonical string representation."""
+ """Return the canonical string representation."""
return self.canonical_prefix()
def __unicode__(self):
- """Return a the custom string representation."""
+ """Return the custom string representation."""
return self.custom_prefix()
def canonical_prefix(self):
@@ -2091,7 +2091,7 @@
Use L{has_extension} instead!
- @param name: The extension to check for, case insenstive
+ @param name: The extension to check for, case insensitive
@type name: str
@param unknown: Old parameter which shouldn't be used anymore.
@return: If the extension is loaded
@@ -2106,7 +2106,7 @@
def has_extension(self, name):
""" Determine whether extension `name` is loaded.
- @param name: The extension to check for, case insenstive
+ @param name: The extension to check for, case insensitive
@type name: str
@return: If the extension is loaded
@rtype: bool
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 33003b4..f27163c 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -1349,7 +1349,7 @@
# all fields matched -> date valid
if all(g in dateDict for g in self.groups):
- # remove 'time' key, now splitted in hour/minute and not needed by datetime
+ # remove 'time' key, now split in hour/minute and not needed by datetime
del dateDict['time']
# replace month name in original language with month number
diff --git a/pywikibot/userinterfaces/gui.py b/pywikibot/userinterfaces/gui.py
index 85bda15..517178f 100644
--- a/pywikibot/userinterfaces/gui.py
+++ b/pywikibot/userinterfaces/gui.py
@@ -196,17 +196,17 @@
# start from the beginning (and when we come to the end, stop)
idx = '1.0'
while True:
- # find next occurence, exit loop if no more
+ # find next occurrence, exit loop if no more
idx = self.search(s, idx, nocase=1, stopindex=Tkinter.END)
if not idx:
break
- # index right after the end of the occurence
+ # index right after the end of the occurrence
lastidx = '%s+%dc' % (idx, len(s))
- # tag the whole occurence (start included, stop excluded)
+ # tag the whole occurrence (start included, stop excluded)
self.tag_add('found', idx, lastidx)
- # prepare to search for next occurence
+ # prepare to search for next occurrence
idx = lastidx
- # use a red foreground for all the tagged occurences
+ # use a red foreground for all the tagged occurrences
self.tag_config('found', foreground='red')
found = self.tag_nextrange('found', 1.0)
if found:
@@ -336,7 +336,7 @@
@type text: unicode
@param jumpIndex: position at which to put the caret
@type jumpIndex: int
- @param highlight: each occurence of this substring will be highlighted
+ @param highlight: each occurrence of this substring will be highlighted
@type highlight: unicode
@return: the modified text, or None if the user didn't save the text
file in his text editor
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py
index 5f37e69..3336392 100755
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -314,7 +314,7 @@
@type text: unicode
@param jumpIndex: position at which to put the caret
@type jumpIndex: int
- @param highlight: each occurence of this substring will be highlighted
+ @param highlight: each occurrence of this substring will be highlighted
@type highlight: unicode
@return: the modified text, or None if the user didn't save the text
file in his text editor
diff --git a/pywikibot/version.py b/pywikibot/version.py
index e82f0c5..c0a93dd 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -35,7 +35,7 @@
@param online: (optional) Include information obtained online
"""
- data = dict(getversiondict()) # copy dict to prevent changes in 'chache'
+ data = dict(getversiondict()) # copy dict to prevent changes in 'cache'
data['cmp_ver'] = 'n/a'
if online:
diff --git a/scripts/category.py b/scripts/category.py
index 04faa05..58df1b6 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -497,7 +497,7 @@
def run(self):
"""The main bot function that does all the work.
- For readability it is splitted into several helper functions:
+ For readability it is split into several helper functions:
- _movecat()
- _movetalk()
- _hist()
diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index 3605fae..1a970e3 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -4,7 +4,7 @@
With this tool you can add the template {{commonscat}} to categories.
The tool works by following the interwiki links. If the template is present on
-another langauge page, the bot will use it.
+another language page, the bot will use it.
You could probably use it at articles as well, but this isn't tested.
diff --git a/scripts/image.py b/scripts/image.py
index 6053795..009478d 100644
--- a/scripts/image.py
+++ b/scripts/image.py
@@ -14,7 +14,7 @@
surround it with single quotes, such as:
-summary:'My edit summary'
-always Don't prompt to make changes, just do them.
--loose Do loose replacements. This will replace all occurences of the name
+-loose Do loose replacements. This will replace all occurrences of the name
of the image (and not just explicit image syntax). This should work
to catch all instances of the image, including where it is used as a
template parameter or in image galleries. However, it can also make
@@ -48,7 +48,7 @@
class ImageRobot(Bot):
- """This bot will replace or remove all occurences of an old image."""
+ """This bot will replace or remove all occurrences of an old image."""
# Summary messages for replacing images
msg_replace = {
diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index d0e7ce0..8d0a84c 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -582,7 +582,7 @@
interwikiPattern = r'\[\[([a-zA-Z\-]+)\s?:([^\[\]\n]*)\]\]\s*'
# won't work with nested templates
# the negative lookahead assures that we'll match the last template
- # occurence in the temp text.
+ # occurrence in the temp text.
# FIXME:
# {{commons}} or {{commonscat}} are part of Weblinks section
# * {{template}} is mostly part of a section
diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py
index a016b3d..ebdf184 100644
--- a/scripts/nowcommons.py
+++ b/scripts/nowcommons.py
@@ -24,7 +24,7 @@
-replacealways replace links if the files are equal and the file names
differ without asking for confirmation
- -replaceloose Do loose replacements. This will replace all occurences
+ -replaceloose Do loose replacements. This will replace all occurrences
of the name of the image (and not just explicit image
syntax). This should work to catch all instances of the
file, including where it is used as a template parameter
diff --git a/scripts/protect.py b/scripts/protect.py
index e1040c6..154493f 100644
--- a/scripts/protect.py
+++ b/scripts/protect.py
@@ -27,7 +27,7 @@
For all protection types (edit, move, etc.) it chooses the default protection
level. This is "sysop" or "none" if -unprotect was selected. If multiple
--unprotect or -default are used, only the last occurence is applied.
+-unprotect or -default are used, only the last occurrence is applied.
Usage: python protect.py <OPTIONS>
diff --git a/scripts/replace.py b/scripts/replace.py
index c68b161..7c6809f 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -44,11 +44,11 @@
argument is given, XYZ will be regarded as a regular
expression.
--exceptinside:XYZ Skip occurences of the to-be-replaced text which lie
+-exceptinside:XYZ Skip occurrences of the to-be-replaced text which lie
within XYZ. If the -regex argument is given, XYZ will be
regarded as a regular expression.
--exceptinsidetag:XYZ Skip occurences of the to-be-replaced text which lie
+-exceptinsidetag:XYZ Skip occurrences of the to-be-replaced text which lie
within an XYZ tag.
-summary:XYZ Set the summary message text for the edit to XYZ, bypassing
@@ -74,7 +74,7 @@
-recursive Recurse replacement as long as possible. Be careful, this
might lead to an infinite loop.
--allowoverlap When occurences of the pattern overlap, replace all of them.
+-allowoverlap When occurrences of the pattern overlap, replace all of them.
Be careful, this might lead to an infinite loop.
-fullsummary Use one large summary for all command line replacements.
@@ -296,7 +296,7 @@
compiled regular expression) and replacement
text (as a string).
* exceptions - A dictionary which defines when to ignore an
- occurence. See docu of the ReplaceRobot
+ occurrence. See docu of the ReplaceRobot
constructor below.
"""
@@ -395,7 +395,7 @@
compiled regular expression) and replacement
text (as a string).
* exceptions - A dictionary which defines when not to change an
- occurence. See below.
+ occurrence. See below.
* acceptall - If True, the user won't be prompted before changes
are made.
* allowoverlap - If True, when matches overlap, all of them are
@@ -414,7 +414,7 @@
contains a part which is matched by one of these regular
expressions are skipped.
inside
- A list of regular expressions. All occurences are skipped which
+ A list of regular expressions. All occurrences are skipped which
lie within a text region which is matched by one of these
regular expressions.
inside-tags
diff --git a/scripts/replicate_wiki.py b/scripts/replicate_wiki.py
index 7d4da0f..41d7a11 100644
--- a/scripts/replicate_wiki.py
+++ b/scripts/replicate_wiki.py
@@ -17,7 +17,7 @@
'wikipedia:li': {'Hoofdpagina': 'Veurblaad'}
}
-to replace all occurences of 'Hoofdpagina' with 'Veurblaad' when writing to
+to replace all occurrences of 'Hoofdpagina' with 'Veurblaad' when writing to
liwiki. Note that this does not take the origin wiki into account.
The following parameters are supported:
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 34ef463..a0a9aa1 100644
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -430,7 +430,7 @@
def ignore(self, refPage):
if self.enabled:
- # Skip this occurence next time.
+ # Skip this occurrence next time.
filename = config.datafilepath(
'disambiguations',
self.disambPage.title(asUrl=True) + '.txt')
@@ -716,7 +716,7 @@
# skip this page
if self.primary:
# If run with the -primary argument, skip this
- # occurence next time.
+ # occurrence next time.
self.primaryIgnoreManager.ignore(refPage)
return True
elif choice in ['q', 'Q']:
diff --git a/scripts/template.py b/scripts/template.py
index 5eaa837..de98b32 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -13,7 +13,7 @@
Command line options:
--remove Remove every occurence of the template from every article
+-remove Remove every occurrence of the template from every article
-subst Resolves the template by putting its text directly into the
article. This is done by changing {{...}} or {{msg:...}} into
@@ -147,7 +147,7 @@
class XmlDumpTemplatePageGenerator:
"""
- Generator which yield Pages that transclude a template.
+ Generator which yields Pages that transclude a template.
These pages will be retrieved from a local XML dump file
(cur table), and may not still transclude the template.
@@ -194,7 +194,7 @@
class TemplateRobot(Bot):
- """This bot will replace, remove or subst all occurences of a template."""
+ """This bot will replace, remove or subst all occurrences of a template."""
def __init__(self, generator, templates, **kwargs):
"""
diff --git a/scripts/upload.py b/scripts/upload.py
index 2d86ddb..91e1976 100755
--- a/scripts/upload.py
+++ b/scripts/upload.py
@@ -21,7 +21,7 @@
'M': Megabytes (1000000 B)
'Ki': Kibibytes (1024 B)
'Mi': Mebibytes (1024x1024 B)
- The suffixes are case insenstive.
+ The suffixes are case insensitive.
If any other arguments are given, the first is the URL or filename to upload,
and the rest is a proposed description to go with the upload. If none of these
diff --git a/tests/__init__.py b/tests/__init__.py
index 32eaa93..d32f9f1 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -189,7 +189,7 @@
# of 'red' builds caused by intermittant server problems, while also avoiding
# the builds taking a long time due to retries.
# The following allows builds to retry twice, but higher default values are
-# overriden here to restrict retries to only 1, so developer builds fail more
+# overridden here to restrict retries to only 1, so developer builds fail more
# frequently in code paths resulting from mishandled server problems.
if config.max_retries > 2:
print('max_retries reduced from %d to 1 for tests' % config.max_retries)
diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py
index 63b18dc..f5dc65f 100644
--- a/tests/i18n_tests.py
+++ b/tests/i18n_tests.py
@@ -225,13 +225,13 @@
def testMultipleWrongParameterLength(self):
"""Test wrong parameter length."""
- with self.assertRaisesRegex(ValueError, "Length of parameter does not match PLURAL occurences"):
+ with self.assertRaisesRegex(ValueError, "Length of parameter does not match PLURAL occurrences"):
self.assertEqual(
i18n.twntranslate('de', 'test-multiple-plurals', (1, 2))
% {'action': u'Ändere', 'line': u'drei'},
u'Bot: Ändere drei Zeilen von mehreren Seiten.')
- with self.assertRaisesRegex(ValueError, "Length of parameter does not match PLURAL occurences"):
+ with self.assertRaisesRegex(ValueError, "Length of parameter does not match PLURAL occurrences"):
self.assertEqual(
i18n.twntranslate('de', 'test-multiple-plurals', ["321"])
% {'action': u'Ändere', 'line': u'dreihunderteinundzwanzig'},
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 4b56794..224f76d 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -149,7 +149,7 @@
self.assertTrue(mysite.sametitle('Test name', 'Test name'))
self.assertFalse(mysite.sametitle('Test name', 'Test Name'))
# User, MediaWiki (both since 1.16) and Special are always
- # first-letter (== only first non-namespace letter is case insenstive)
+ # first-letter (== only first non-namespace letter is case insensitive)
# See also: https://www.mediawiki.org/wiki/Manual:$wgCapitalLinks
self.assertTrue(mysite.sametitle("Special:Always", "Special:always"))
if LV(mysite.version()) >= LV('1.16'):
--
To view, visit https://gerrit.wikimedia.org/r/178720
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I960e5e8dc107f3f1d3eb59a5088f4fc73aa1b191
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
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: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Simpler sitematrix access in APISite.fromDBName()
......................................................................
Simpler sitematrix access in APISite.fromDBName()
by using .items()
Change-Id: Ifea48f7b969ec88764f546f36edb6d085d38b282
---
M pywikibot/site.py
1 file changed, 6 insertions(+), 6 deletions(-)
Approvals:
XZise: Looks good to me, approved
Mpaa: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index e0f4b49..b1d33e0 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -1460,18 +1460,18 @@
site=pywikibot.Site('meta', 'meta'),
action='sitematrix')
data = req.submit()
- for num in data['sitematrix']:
- if num == 'count':
+ for key, val in data['sitematrix'].items():
+ if key == 'count':
continue
- if 'code' in data['sitematrix'][num]:
- lang = data['sitematrix'][num]['code']
- for site in data['sitematrix'][num]['site']:
+ if 'code' in val:
+ lang = val['code']
+ for site in val['site']:
if site['dbname'] == dbname:
if site['code'] == 'wiki':
site['code'] = 'wikipedia'
return APISite(lang, site['code'])
else:
- for site in data['sitematrix'][num]:
+ for site in val:
if site['dbname'] == dbname:
return APISite(site['code'], site['code'])
raise ValueError("Cannot parse a site out of %s." % dbname)
--
To view, visit https://gerrit.wikimedia.org/r/178654
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifea48f7b969ec88764f546f36edb6d085d38b282
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
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: Mpaa <mpaa.wiki(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: Add developer instructions for using travis-ci
......................................................................
Add developer instructions for using travis-ci
Change-Id: Ic2fc7f0975bda22ffad03f99add2b2a383d7c791
---
M .travis.yml
M tests/README.rst
2 files changed, 55 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.travis.yml b/.travis.yml
index c708c6a..414475a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,5 @@
+# See tests/README.rst for instructions for using travis with developer builds.
+
language: python
python:
@@ -59,10 +61,10 @@
env:
global:
- # This is the encrypted password, which can only be decrypted by Travis itself
- # See http://docs.travis-ci.com/user/encryption-keys/
- # And http://docs.travis-ci.com/user/build-configuration/#Secure-environment-vari…
- # Command use to generate: travis encrypt USER_PASSWORD=<pwd> -r wikimedia/pywikibot-core
+ # This is the encrypted password for Wikimedia SUL user 'Pywikibot-test',
+ # and is only decrypted by Travis when running builds of code merged into
+ # the github repository 'wikimedia/pywikibot-core'.
+ # See http://docs.travis-ci.com/user/encryption-keys/ for more information.
- secure: kofInMlisiTBt9o/Ustc/vySlkKfxGzGCX2LwA1D2waym8sDTS0o5gMJ5LsrT/BUKwZbe1vLozPHqZrrkQvsdTml+DpZuotzdILs0m0f3BUoexEC6OON5IDljuxFyETrD1Ug44ih5Mc4lVFOdTcBzg501ZmswGwQrBvg/OyEFfE=
matrix:
- LANGUAGE=en FAMILY=wikipedia
diff --git a/tests/README.rst b/tests/README.rst
index e5e289d..4258016 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -10,8 +10,8 @@
'load tests protocol'.
<https://docs.python.org/2/library/unittest.html#load-tests-protocol>.
The default ordering begins with tests of underlying components, then tests
-site and page semantics, and finishes with tests of the scripts and tests
-which are not yet included in the ordered tests.
+site and page semantics, and finishes with tests of the scripts and finally
+any tests which have not been inserted into the ordered list of tests.
A function collector also exists in the 'tests' package.
@@ -71,6 +71,41 @@
python pwb.py tests/site_tests.py -v
+travis-ci
+=========
+
+After changes are published into a github repository, tests may be run on
+travis-ci.org according to the configuration in .travis.yml .
+
+When changes are merged into the main repository, they are replicated to
+https://github.com/wikimedia/pywikibot-core , and travis tests are run and
+published at travis-ci.org/wikimedia/pywikibot-core/builds . These tests
+use the Wikimedia global (SUL) account 'Pywikibot-test', which has a password
+securely stored in .travis.yml . See section env:global:secure.
+
+Anyone can run these tests on travis-ci.org using their own account, with
+code changes that have not been merged into the main repository. To do this:
+
+1. create a github and travis-ci account
+2. fork the main github repository https://github.com/wikimedia/pywikibot-core
+3. enable builds from the travis profile page: https://travis-ci.org/profile
+4. push changes into the forked git repository
+5. watch the build at https://travis-ci.org/<username>/pywikibot-core/builds
+
+Only travis-ci builds from the main repository can access the password for the
+Wikimedia account 'Pywikibot-test'. All tests which require a logged in user
+are skipped if the travis-ci build environment does not have a password.
+
+To enable 'user' tests on travis-ci builds for a different repository, add
+a username and password to travis:
+
+1. Go to https://travis-ci.org/<username>/pywikibot-core/settings/env_vars
+2. Add a new variable named PYWIKIBOT2_USERNAME and a value of a valid
+ Wikimedia SUL username
+3. Add another variable named USER_PASSWORD, with the private password for
+ the Wikimedia SUL username used in step 2
+4. The next build should run tests that require a logged in user
+
Contributing tests
==================
@@ -118,6 +153,18 @@
self.get_site('itwikt')
+For tests which require network access to a website which is not an APISite,
+the class attribute 'sites' may include a hostname.
+
+::
+
+ sites = {
+ 'wdq':
+ 'hostname': 'wdq.wmflabs.org',
+ }
+ }
+
+
Other class attributes
----------------------
--
To view, visit https://gerrit.wikimedia.org/r/178429
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic2fc7f0975bda22ffad03f99add2b2a383d7c791
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 bug in returned value of APISite.watch
......................................................................
Fix bug in returned value of APISite.watch
Also add test for using Page.watch on the bot userpage,
which is obtained via new method TestCase.get_userpage.
Additional bug T77965 (badtoken) found.
Change-Id: Ibfe513a3351fb0a8bde5dc35862abc878f30c386
---
M pywikibot/site.py
M tests/aspects.py
M tests/page_tests.py
3 files changed, 35 insertions(+), 4 deletions(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 3c2c782..e0f4b49 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -4354,9 +4354,7 @@
if "watch" not in result:
pywikibot.error(u"watchpage: Unexpected API response:\n%s" % result)
return False
- watched = result["watch"]
- return ((unwatch and "unwatched" in watched)
- or (not unwatch and "watched" in result))
+ return ('unwatched' if unwatch else 'watched') in result["watch"]
@must_be(group='user')
def purgepages(self, pages, **kwargs):
diff --git a/tests/aspects.py b/tests/aspects.py
index 6466018..5e39c0c 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -475,6 +475,25 @@
if not site.logged_in(sysop):
site.login(sysop)
+ def get_userpage(self, site=None):
+ """Create a User object for the user's userpage."""
+ if not site:
+ site = self.get_site()
+
+ if hasattr(self, '_userpage'):
+ # For multi-site test classes, or site is specified as a param,
+ # the cached userpage object may not be the desired site.
+ if self._userpage.site == site:
+ return self._userpage
+
+ sysop = hasattr(self, 'sysop') and self.sysop
+
+ userpage = pywikibot.User(site, site.username(sysop))
+
+ self._userpage = userpage
+
+ return userpage
+
class MetaTestCaseClass(type):
diff --git a/tests/page_tests.py b/tests/page_tests.py
index 1bb1fde..2168ff2 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -14,6 +14,7 @@
import pywikibot.page
from tests.aspects import unittest, TestCase, DefaultSiteTestCase
+from tests.utils import allowed_failure
if sys.version_info[0] > 2:
basestring = (str, )
@@ -593,13 +594,26 @@
"""Test page user actions."""
- cached = True
user = True
def test_purge(self):
mainpage = self.get_mainpage()
self.assertIsInstance(mainpage.purge(), bool)
+ @allowed_failure
+ def test_watch(self):
+ """Test Page.watch, with and without unwatch enabled."""
+ # Note: this test uses the userpage, so that it is unwatched and
+ # therefore is not listed by script_tests test_watchlist_simulate.
+ # FIXME: T77965: fails on ar.wp and test.wd, but not en.wp and fr.wikt
+ userpage = self.get_userpage()
+ rv = userpage.watch()
+ self.assertIsInstance(rv, bool)
+ self.assertTrue(rv)
+ rv = userpage.watch(unwatch=True)
+ self.assertIsInstance(rv, bool)
+ self.assertTrue(rv)
+
if __name__ == '__main__':
try:
--
To view, visit https://gerrit.wikimedia.org/r/178453
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibfe513a3351fb0a8bde5dc35862abc878f30c386
Gerrit-PatchSet: 3
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: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>