jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/433559 )
Change subject: Fix N803 errors within tests/* ......................................................................
Fix N803 errors within tests/*
Change-Id: I2d5e3892e069e77339c5894a0f168da3b5b99921 --- M tests/pagegenerators_tests.py M tests/tools_ip_tests.py M tests/ui_tests.py M tox.ini 4 files changed, 22 insertions(+), 19 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py index 7a98d93..b1bf150 100755 --- a/tests/pagegenerators_tests.py +++ b/tests/pagegenerators_tests.py @@ -478,18 +478,18 @@ cls.site = cls.get_site() cls.fd = date.FormatDate(cls.site)
- def _run_test(self, startMonth=1, endMonth=12, year=2000): + def _run_test(self, start_month=1, end_month=12, year=2000): """Test method for DayPageGenerator.""" params = { - 'startMonth': startMonth, - 'endMonth': endMonth, + 'start_month': start_month, + 'end_month': end_month, 'site': self.site, } if year != 2000: params['year'] = year # use positional parameter - gen1 = pagegenerators.DayPageGenerator(startMonth, endMonth, self.site, - year) + gen1 = pagegenerators.DayPageGenerator( + start_month, end_month, self.site, year) # use keyworded parameter and default for year gen2 = pagegenerators.DayPageGenerator(**params)
@@ -498,7 +498,7 @@ self.assertTrue(page.isAutoTitle)
expected = [] - for month in range(startMonth, endMonth + 1): + for month in range(start_month, end_month + 1): for day in range(1, calendar.monthrange(year, month)[1] + 1): expected.append(self.fd(month, day))
@@ -514,7 +514,7 @@
def test_year_2100(self): """Test for day page generator of year 2100.""" - self._run_test(endMonth=2, year=2100) + self._run_test(end_month=2, year=2100)
def test_start_0(self): """Test for day page generator with startMonth 0.""" diff --git a/tests/tools_ip_tests.py b/tests/tools_ip_tests.py index 3520b64..9820407 100644 --- a/tests/tools_ip_tests.py +++ b/tests/tools_ip_tests.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """Test IP module/regex.""" # -# (C) Pywikibot team, 2012-2015 +# (C) Pywikibot team, 2012-2018 # # Distributed under the terms of the MIT license. from __future__ import absolute_import, unicode_literals @@ -39,16 +39,16 @@ '{0} of {1} tests failed:\n{2}'.format( self.fail, self.total, '\n'.join(self.errors)))
- def ipv6test(self, result, IP): - """Perform one IP test.""" + def ipv6test(self, result, ip_address): + """Perform one ip_address test.""" self.total += 1 try: - self.assertEqual(result, self._do_ip_test(IP)) + self.assertEqual(result, self._do_ip_test(ip_address)) except AssertionError: self.fail += 1 self.errors.append( '"%s" match should be %s - not OK' - % (IP, result)) + % (ip_address, result))
def _run_tests(self): """Test various IP.""" diff --git a/tests/ui_tests.py b/tests/ui_tests.py index 861a235..7962adc 100644 --- a/tests/ui_tests.py +++ b/tests/ui_tests.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Tests for the user interface.""" # -# (C) Pywikibot team, 2008-2017 +# (C) Pywikibot team, 2008-2018 # # Distributed under the terms of the MIT license. # @@ -146,13 +146,14 @@ s.serve_forever()
-def patched_print(text, targetStream): +def patched_print(text, target_stream): try: - stream = patched_streams[targetStream] + stream = patched_streams[target_stream] except KeyError: - assert isinstance(targetStream, pywikibot.userinterfaces.win32_unicode.UnicodeOutput) - assert targetStream._stream - stream = patched_streams[targetStream._stream] + assert isinstance(target_stream, + pywikibot.userinterfaces.win32_unicode.UnicodeOutput) + assert target_stream._stream + stream = patched_streams[target_stream._stream] org_print(text, stream)
diff --git a/tox.ini b/tox.ini index 132dbf5..9c7f7ca 100644 --- a/tox.ini +++ b/tox.ini @@ -162,7 +162,7 @@ # D413: Missing blank line after last section # D412: No blank lines allowed between a section header and its content
-ignore = D105,D211,FI10,FI12,FI13,FI15,FI16,FI17,FI5,H101,H236,H301,H404,H405,H903,N802,N803,N806,D401,D413,D103,D412,P101,W503 +ignore = D105,D211,FI10,FI12,FI13,FI15,FI16,FI17,FI5,H101,H236,H301,H404,H405,H903,N802,N806,D401,D413,D103,D412,P101,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 @@ -172,6 +172,7 @@ generate_family_file.py : T001 pwb.py : T001 setup.py : T001 + pywikibot/** : N803 pywikibot/comms/http.py : T001 pywikibot/date.py : E241 pywikibot/family.py : E241 @@ -187,6 +188,7 @@ scripts/imagetransfer.py : E241 tests/ui_tests.py : D102, D103, N801 tests/* : N813 + scripts/* : N803 scripts/checkimages.py : N801 scripts/imagecopy.py : N801 scripts/imagecopy_self.py : N801
pywikibot-commits@lists.wikimedia.org