jenkins-bot merged this change.

View Change

Approvals: Dvorapa: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
tox.ini: Use the default max_line_length

Fix the remaining E501 (line too long) errors.

ui_tests.py:
replace "easy_install --upgrade \
https://pywinauto.googlecode.com/files/pywinauto-0.4.2.zipeasy_install \
--upgrade https://pywinauto.googlecode.com/files/pywinauto-0.4.2.zip"
comment with "pip install -U pywinauto". It's not clear why the a
specific version was recommended. setup.py uses the latest version.

setup.py:
Remove the "FIXME: tests/ui_tests.py suggests pywinauto 0.4.2" comment.

Change-Id: I788b09ac54779ec46c6fad17911ed634c20b4d4a
---
M docs/conf.py
M pwb.py
M setup.py
M tests/page_tests.py
M tests/tools_chars_tests.py
M tests/tools_tests.py
M tests/ui_tests.py
M tests/utils.py
M tests/wikibase_edit_tests.py
M tests/wikibase_tests.py
M tests/xmlreader_tests.py
M tox.ini
12 files changed, 53 insertions(+), 35 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 079af53..14f7986 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -8,7 +8,7 @@
# Pywikibot documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 5 15:50:05 2014.
#
-# This file is execfile()d with the current directory set to its containing dir.
+# This file is execfile()d with the current dir set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
diff --git a/pwb.py b/pwb.py
index c77ebdb..26d6d66 100755
--- a/pwb.py
+++ b/pwb.py
@@ -185,8 +185,8 @@
run_python_file(os.path.join(_pwb_dir, 'generate_user_files.py'),
['generate_user_files.py'],
['generate_user_files.py'])
- # because we have loaded pywikibot without user-config.py loaded, we need to re-start
- # the entire process. Ask the user to do so.
+ # because we have loaded pywikibot without user-config.py loaded,
+ # we need to re-start the entire process. Ask the user to do so.
print('Now, you have to re-execute the command to start your script.')
sys.exit(1)

diff --git a/setup.py b/setup.py
index 6de8817..9800e7e 100644
--- a/setup.py
+++ b/setup.py
@@ -105,7 +105,8 @@
# The main pywinauto repository doesnt support Python 3.
# The repositories used below have a Python 3 compliant setup.py
dependency_links = [
- 'git+https://github.com/AlereDevices/lunatic-python.git#egg=lunatic-python',
+ 'git+https://github.com/AlereDevices/lunatic-python.git#egg='
+ 'lunatic-python',
'hg+https://bitbucket.org/TJG/pywin32#egg=pywin32',
'git+https://github.com/vasily-v-ryabov/pywinauto-64#egg=pywinauto',
]
@@ -163,7 +164,6 @@
# Microsoft makes available a compiler for Python 2.7
# http://www.microsoft.com/en-au/download/details.aspx?id=44266
if os.name == 'nt' and os.environ.get('PYSETUP_TEST_NO_UI', '0') != '1':
- # FIXME: tests/ui_tests.py suggests pywinauto 0.4.2
# which isnt provided on pypi.
test_deps += ['pywin32', 'pywinauto>=0.4.0']

diff --git a/tests/page_tests.py b/tests/page_tests.py
index acb37d7..4cc8062 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -476,7 +476,8 @@
"""Test the integration with Extension:Disambiguator."""
site = self.get_site()
if not site.has_extension('Disambiguator'):
- raise unittest.SkipTest('Disambiguator extension not loaded on test site')
+ raise unittest.SkipTest(
+ 'Disambiguator extension not loaded on test site')
pg = pywikibot.Page(site, 'Random')
pg._pageprops = {'disambiguation', ''}
self.assertTrue(pg.isDisambig())
diff --git a/tests/tools_chars_tests.py b/tests/tools_chars_tests.py
index 72ee4f9..cab060c 100644
--- a/tests/tools_chars_tests.py
+++ b/tests/tools_chars_tests.py
@@ -24,8 +24,10 @@

def test_replace(self):
"""Test replace_invisible."""
- self.assertEqual(chars.replace_invisible('Hello world!'), 'Hello world!')
- self.assertEqual(chars.replace_invisible('\u200eRTL\u200f'), '<200e>RTL<200f>')
+ self.assertEqual(
+ chars.replace_invisible('Hello world!'), 'Hello world!')
+ self.assertEqual(
+ chars.replace_invisible('\u200eRTL\u200f'), '<200e>RTL<200f>')

def test_contains(self):
"""Test contains_invisible."""
diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index 58c7ae3..20ff4f1 100644
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -73,8 +73,9 @@
'pywikibot.tools.ContextManagerWrapper is deprecated.'):
wrapper = tools.ContextManagerWrapper(self.DummyClass())
self.assertFalse(wrapper.closed)
- with self.assertRaisesRegex(ZeroDivisionError,
- '(integer division or modulo by zero|division by zero)'):
+ with self.assertRaisesRegex(
+ ZeroDivisionError,
+ '(integer division or modulo by zero|division by zero)'):
with wrapper:
1 / 0
self.assertTrue(wrapper.closed)
@@ -108,13 +109,16 @@

def test_open_archive_normal(self):
"""Test open_archive with no compression in the standard library."""
- self.assertEqual(self._get_content(self.base_file), self.original_content)
+ self.assertEqual(
+ self._get_content(self.base_file), self.original_content)

def test_open_archive_bz2(self):
"""Test open_archive with bz2 compressor in the standard library."""
- self.assertEqual(self._get_content(self.base_file + '.bz2'), self.original_content)
- self.assertEqual(self._get_content(self.base_file + '.bz2', use_extension=False),
- self.original_content)
+ self.assertEqual(
+ self._get_content(self.base_file + '.bz2'), self.original_content)
+ self.assertEqual(
+ self._get_content(self.base_file + '.bz2', use_extension=False),
+ self.original_content)

@require_modules('bz2file')
def test_open_archive_with_bz2file(self):
@@ -146,7 +150,8 @@

def test_open_archive_gz(self):
"""Test open_archive with gz compressor in the standard library."""
- self.assertEqual(self._get_content(self.base_file + '.gz'), self.original_content)
+ self.assertEqual(
+ self._get_content(self.base_file + '.gz'), self.original_content)

def test_open_archive_7z(self):
"""Test open_archive with 7za if installed."""
@@ -154,7 +159,8 @@
subprocess.Popen(['7za'], stdout=subprocess.PIPE).stdout.close()
except OSError:
raise unittest.SkipTest('7za not installed')
- self.assertEqual(self._get_content(self.base_file + '.7z'), self.original_content)
+ self.assertEqual(
+ self._get_content(self.base_file + '.7z'), self.original_content)
self.assertRaisesRegex(OSError,
'Unexpected STDERR output from 7za ',
self._get_content,
@@ -225,7 +231,8 @@
self.assertRaisesRegex(ValueError,
'Magic number detection only when reading',
tools.open_archive,
- '/dev/null', 'wb', False) # writing without extension
+ # writing without extension
+ '/dev/null', 'wb', False)

def test_binary_mode(self):
"""Test that it uses binary mode."""
@@ -283,7 +290,8 @@
def test_conflict(self):
"""Test that it detects conflicts."""
self.assertRaisesRegex(
- ValueError, '42', tools.merge_unique_dicts, self.dct1, **{'42': 'bad'})
+ ValueError, '42', tools.merge_unique_dicts, self.dct1,
+ **{'42': 'bad'})
self.assertRaisesRegex(
ValueError, '42', tools.merge_unique_dicts, self.dct1, self.dct1)
self.assertRaisesRegex(
@@ -329,7 +337,8 @@
"""Test marker is shown with start and stop with kwargs."""
start = 1
stop = 3
- it = list(tools.islice_with_ellipsis(self.it, start, stop, marker='new'))
+ it = list(tools.islice_with_ellipsis(
+ self.it, start, stop, marker='new'))
self.assertEqual(len(it), stop - start + 1) # +1 to consider marker.
self.assertEqual(it[:-1], self.it[start:stop])
self.assertNotEqual(it[-1], '…')
@@ -551,7 +560,7 @@
for _ in self.decs:
self.assertEqual(id(next(deduper)), deduped.pop())
self.assertRaises(StopIteration, next, deduper)
- # No. of Decimal with distinct ids != no. of Decimal with distinct value.
+ # len(Decimal with distinct ids) != len(Decimal with distinct value).
deduper_ids = list(tools.filter_unique(self.decs, key=id))
self.assertNotEqual(len(deduper_ids), len(set(deduper_ids)))

diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index 7fc1934..09d1cc0 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -9,11 +9,11 @@
#
# Windows UI tests have to be run using the tests\ui_tests.bat helper script.
# This will set PYTHONPATH and PYWIKIBOT_DIR, and then run the tests. Do not
-# touch mouse or keyboard while the tests are running, as this might disturb the
-# interaction tests.
+# touch mouse or keyboard while the tests are running, as this might disturb
+# the interaction tests.
#
-# The Windows tests were developed on a Dutch Windows 7 OS. You might need to adapt the
-# helper functions in TestWindowsTerminalUnicode for other versions.
+# The Windows tests were developed on a Dutch Windows 7 OS. You might need to
+# adapt the helper functions in TestWindowsTerminalUnicode for other versions.
#
# For the Windows-based tests, you need the following packages installed:
# - pywin32, for clipboard access, which can be downloaded here:
@@ -21,7 +21,7 @@
# make sure to download the package for the correct python version!
#
# - pywinauto, to send keys to the terminal, which can be installed using:
-# easy_install --upgrade https://pywinauto.googlecode.com/files/pywinauto-0.4.2.zip
+# pip install -U pywinauto
#
#
from __future__ import absolute_import, division, unicode_literals
diff --git a/tests/utils.py b/tests/utils.py
index e9b7cf9..ff13b92 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -420,7 +420,8 @@
aliases = []
for alias in ('PrefixIndex', ):
# TODO: Not all follow that scheme (e.g. "BrokenRedirects")
- aliases.append({'realname': alias.capitalize(), 'aliases': [alias]})
+ aliases.append(
+ {'realname': alias.capitalize(), 'aliases': [alias]})
self._siteinfo._cache['specialpagealiases'] = (aliases, True)
self._msgcache = {'*': 'dummy entry', 'hello': 'world'}

diff --git a/tests/wikibase_edit_tests.py b/tests/wikibase_edit_tests.py
index 497cfa1..ee082d7 100644
--- a/tests/wikibase_edit_tests.py
+++ b/tests/wikibase_edit_tests.py
@@ -73,7 +73,8 @@
if 'P115' in item.claims:
item.removeClaims(item.claims['P115'])

- claim = pywikibot.page.Claim(testsite, 'P115', datatype='wikibase-item')
+ claim = pywikibot.page.Claim(
+ testsite, 'P115', datatype='wikibase-item')
target = pywikibot.ItemPage(testsite, 'Q271')
claim.setTarget(target)

@@ -94,7 +95,8 @@
to_remove.append({'id': claim.toJSON()['id'], 'remove': ''})
item.editEntity({'claims': to_remove})

- claim = pywikibot.page.Claim(testsite, 'P115', datatype='wikibase-item')
+ claim = pywikibot.page.Claim(
+ testsite, 'P115', datatype='wikibase-item')
target = pywikibot.ItemPage(testsite, 'Q271')
claim.setTarget(target)
item.editEntity({'claims': [claim.toJSON()]})
@@ -225,7 +227,8 @@
item = self._clean_item(testsite, 'P271')

# set new claim
- claim = pywikibot.page.Claim(testsite, 'P271', datatype='monolingualtext')
+ claim = pywikibot.page.Claim(
+ testsite, 'P271', datatype='monolingualtext')
target = pywikibot.WbMonolingualText(text='Test this!', language='en')
claim.setTarget(target)
item.addClaim(claim)
@@ -378,7 +381,8 @@
if 'P115' in item.claims:
item.removeClaims(item.claims['P115'])

- claim = pywikibot.page.Claim(testsite, 'P115', datatype='wikibase-item')
+ claim = pywikibot.page.Claim(
+ testsite, 'P115', datatype='wikibase-item')
target = pywikibot.ItemPage(testsite, 'Q271')
claim.setTarget(target)
item.addClaim(claim)
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 6ec66a4..c979a41 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -1445,7 +1445,8 @@
wikidata = self.get_repo()
claim = pywikibot.Claim(wikidata, 'P569')
self.assertEqual(claim.type, 'time')
- claim.setTarget(pywikibot.WbTime(year=2001, month=1, day=1, site=wikidata))
+ claim.setTarget(pywikibot.WbTime(
+ year=2001, month=1, day=1, site=wikidata))
self.assertEqual(claim.target.year, 2001)
self.assertEqual(claim.target.month, 1)
self.assertEqual(claim.target.day, 1)
@@ -1676,7 +1677,8 @@
"""Test PreloadingEntityGenerator with ReferringPageGenerator."""
site = self.get_site('wikidata')
instance_of_page = pywikibot.Page(site, 'Property:P31')
- ref_gen = pagegenerators.ReferringPageGenerator(instance_of_page, total=5)
+ ref_gen = pagegenerators.ReferringPageGenerator(
+ instance_of_page, total=5)
gen = pagegenerators.PreloadingEntityGenerator(ref_gen)
self.assertTrue(all(isinstance(item, ItemPage) for item in gen))

diff --git a/tests/xmlreader_tests.py b/tests/xmlreader_tests.py
index 75bc121..ebd84ba 100644
--- a/tests/xmlreader_tests.py
+++ b/tests/xmlreader_tests.py
@@ -56,7 +56,8 @@
"""Test XmlDump correctly parsing whether a page is a redirect."""
pages = self._get_entries('article-pyrus.xml', allrevisions=True)
pages = [r for r in
- xmlreader.XmlDump(join_xml_data_path('article-pyrus.xml')).parse()]
+ xmlreader.XmlDump(
+ join_xml_data_path('article-pyrus.xml')).parse()]
self.assertTrue(pages[0].isredirect)

def _compare(self, previous, variant, all_revisions):
diff --git a/tox.ini b/tox.ini
index eef3f32..0dabaff 100644
--- a/tox.ini
+++ b/tox.ini
@@ -138,7 +138,6 @@
ignore = D105,D211,FI12,FI13,FI15,FI16,FI17,FI5,H101,H236,H301,H404,H405,H903,D401,D413,D412,P101,P102,P103,W503
exclude = .tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*,scripts/userscripts/*
min-version = 2.7
-max_line_length = 100
accept-encodings = utf-8
require-code = true
classmethod-decorators = classmethod,classproperty
@@ -276,7 +275,6 @@

[pep8]
exclude = .tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*,scripts/userscripts/*
-max_line_length = 100

[pep257]
# see explanations above

To view, visit change 464777. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I788b09ac54779ec46c6fad17911ed634c20b4d4a
Gerrit-Change-Number: 464777
Gerrit-PatchSet: 1
Gerrit-Owner: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)