jenkins-bot has submitted this change and it was merged.
Change subject: Flakes ......................................................................
Flakes
Fix unused imports, redefined methods, and a comment not compliant with pep8
Change-Id: Ia1be0e7170b2b6519dfefed57f4bc39148d3e377 --- M tests/__init__.py M tests/dry_api_tests.py M tests/ui_tests.py M tests/wikibase_tests.py 4 files changed, 10 insertions(+), 5 deletions(-)
Approvals: John Vandenberg: Looks good to me, but someone else must approve Ladsgroup: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/__init__.py b/tests/__init__.py index 6f85ad7..99fd1da 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -9,6 +9,9 @@ import os import sys
+__all__ = ['httplib2', 'OrderedDict', '_cache_dir', 'TestRequest', + 'patch_request', 'unpatch_request'] + # Verify that the unit tests have a base working environment: # - httplib2 is mandatory # - ordereddict is only needed as a fallback for python 2.6 @@ -73,6 +76,9 @@ return super(TestRequest, self)._write_cache(data)
+original_expired = None + + def patch_request(): global original_expired pywikibot.data.api.Request = TestRequest diff --git a/tests/dry_api_tests.py b/tests/dry_api_tests.py index 1714b59..95fb173 100644 --- a/tests/dry_api_tests.py +++ b/tests/dry_api_tests.py @@ -8,7 +8,6 @@ #
import datetime -import hashlib import pywikibot from pywikibot.data.api import CachedRequest, QueryGenerator from utils import unittest diff --git a/tests/ui_tests.py b/tests/ui_tests.py index c072d32..76736b6 100644 --- a/tests/ui_tests.py +++ b/tests/ui_tests.py @@ -49,6 +49,7 @@ class pywikibotWrapper(object): def init(self): import pywikibot + pywikibot.version._get_program_dir()
def output(self, *args, **kwargs): import pywikibot @@ -181,7 +182,7 @@ self.assertEqual(newstdout.getvalue(), "") self.assertEqual(newstderr.getvalue(), "output\n")
- def test_output(self): + def test_output_stdout(self): pywikibot.output("output", toStdout=True) self.assertEqual(newstdout.getvalue(), "output\n") self.assertEqual(newstderr.getvalue(), "") @@ -221,7 +222,7 @@ self.assertEqual(newstdout.getvalue(), "") self.assertEqual(newstderr.getvalue(), "ERROR: TestException: Testing Exception\n")
- def test_exception(self): + def test_exception_tb(self): class TestException(Exception): pass try: @@ -462,7 +463,6 @@ class TestWindowsTerminalUnicodeArguments(WindowsTerminalTestCase): @classmethod def setUpClass(cls): - import inspect cls.setUpProcess(["cmd", "/k", "echo off"])
@classmethod diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py index aca60b3..b888f77 100644 --- a/tests/wikibase_tests.py +++ b/tests/wikibase_tests.py @@ -205,7 +205,7 @@ # The labels are not updated; assertion showing undesirable behaviour: self.assertEquals(item.labels['en'], 'New York City') # TODO: This is the assertion that this test should be using: - #self.assertTrue(item.labels['en'].lower().endswith('main page')) + # self.assertTrue(item.labels['en'].lower().endswith('main page'))
def test_empty_item(self): # should not raise an error as the constructor only requires