John Vandenberg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/167192

Change subject: PEP257 tests/*.py
......................................................................

PEP257 tests/*.py

Change-Id: I8a3254fc48090b50f68c89a81a7d35f29edb4d25
---
M tests/__init__.py
M tests/data_ingestion_tests.py
M tests/date_tests.py
M tests/file_tests.py
M tests/http_tests.py
M tests/i18n_tests.py
M tests/interwiki_link_tests.py
M tests/ipregex_tests.py
M tests/link_tests.py
M tests/page_tests.py
M tests/pagegenerators_tests.py
M tests/pwb_tests.py
M tests/site_tests.py
M tests/textlib_tests.py
M tests/timestripper_tests.py
M tests/ui_tests.py
M tests/weblib_tests.py
M tests/wikibase_tests.py
M tests/wikidataquery_tests.py
M tests/xmlreader_tests.py
M tox.ini
21 files changed, 166 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/92/167192/1

diff --git a/tests/__init__.py b/tests/__init__.py
index e2bdd7a..b903565 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8  -*-
+"""Package tests."""
 #
 # (C) Pywikibot team, 2007-2014
 #
@@ -17,16 +18,16 @@
 # - ordereddict is only needed as a fallback for python 2.6
 # - mwparserfromhell is optional, so is only imported in textlib_tests
 try:
-    import httplib2
+    import httplib2  # noqa
 except ImportError as e:
     print("ImportError: %s" % e)
     sys.exit(1)
 
 try:
-    from collections import OrderedDict
+    from collections import OrderedDict  # noqa
 except ImportError:
     try:
-        from ordereddict import OrderedDict
+        from ordereddict import OrderedDict  # noqa
     except ImportError as e:
         print("ImportError: %s" % e)
         if sys.version_info[0] == 2 and sys.version_info[1] == 6:
@@ -191,6 +192,7 @@
     """Add caching to every Request except logins."""
 
     def __init__(self, *args, **kwargs):
+        """Constructor."""
         super(TestRequest, self).__init__(0, *args, **kwargs)
 
     def _expired(self, dt):
@@ -225,6 +227,7 @@
 
 
 def patch_request():
+    """Patch Request classes with TestRequest."""
     global original_expired
     pywikibot.data.api.Request = TestRequest
     original_expired = pywikibot.data.api.CachedRequest._expired
@@ -232,5 +235,6 @@
 
 
 def unpatch_request():
+    """Un-patch Request classes with TestRequest."""
     pywikibot.data.api.Request = _original_Request
     pywikibot.data.api.CachedRequest._expired = original_expired
diff --git a/tests/data_ingestion_tests.py b/tests/data_ingestion_tests.py
index 7586528..deec8a1 100644
--- a/tests/data_ingestion_tests.py
+++ b/tests/data_ingestion_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 # -*- coding: utf-8  -*-
 
-"""Unit tests for data_ingestion.py"""
+"""Unit tests for data_ingestion.py script."""
 __version__ = '$Id$'
 
 import os
@@ -11,6 +11,8 @@
 
 
 class TestPhoto(TestCase):
+
+    """Test Photo class."""
 
     net = True
 
@@ -50,6 +52,8 @@
 
 class TestCSVReader(TestCase):
 
+    """Test CSVReader class."""
+
     net = False
 
     def setUp(self):
diff --git a/tests/date_tests.py b/tests/date_tests.py
index 5d26688..8c236f3 100644
--- a/tests/date_tests.py
+++ b/tests/date_tests.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8  -*-
+"""Tests for the date module."""
 #
 # (C) Pywikibot team, 2014
 #
@@ -12,10 +13,10 @@
 
 class TestDateMeta(MetaTestCaseClass):
 
-    """Test meta class"""
+    """Date test meta class."""
 
     def __new__(cls, name, bases, dct):
-        """Create the new class"""
+        """Create the new class."""
         def test_method(formatname):
 
             def testMapEntry(self):
diff --git a/tests/file_tests.py b/tests/file_tests.py
index 8f204bd..f8a7c14 100644
--- a/tests/file_tests.py
+++ b/tests/file_tests.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8  -*-
+"""FilePage tests."""
 #
 # (C) Pywikibot team, 2014
 #
@@ -13,6 +14,8 @@
 
 class TestShareFiles(TestCase):
 
+    """Test methods fileIsShared, exists and fileUrl with shared files."""
+
     sites = {
         'enwiki': {
             'family': 'wikipedia',
diff --git a/tests/http_tests.py b/tests/http_tests.py
index 395c95f..6dbfa9e 100644
--- a/tests/http_tests.py
+++ b/tests/http_tests.py
@@ -16,6 +16,8 @@
 
 class HttpTestCase(TestCase):
 
+    """HTTP get tests."""
+
     net = True
 
     def test_get(self):
@@ -78,6 +80,8 @@
 
 class DefaultUserAgentTestCase(TestCase):
 
+    """HTTP user-agent tests."""
+
     net = False
 
     def setUp(self):
diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py
index 39c9ef2..63b18dc 100644
--- a/tests/i18n_tests.py
+++ b/tests/i18n_tests.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8  -*-
+"""Test i18n module."""
 #
 # (C) Pywikibot team, 2007-2014
 #
@@ -12,6 +13,8 @@
 
 
 class TestTranslate(TestCase):
+
+    """Test translate method."""
 
     net = False
 
@@ -75,6 +78,8 @@
 
 class TestTWN(TestCase):
 
+    """Base class for TranslateWiki tests."""
+
     net = False
 
     def setUp(self):
@@ -88,6 +93,8 @@
 
 
 class TestTWTranslate(TestTWN):
+
+    """Test twtranslate method."""
 
     def testLocalized(self):
         self.assertEqual(i18n.twtranslate('en', 'test-localized'),
@@ -231,7 +238,7 @@
                 u'Bot: Ändere dreihunderteinundzwanzig Zeilen von mehreren 
Seiten.')
 
     def testMultipleNonNumbers(self):
-        """Numbers or string numbers are required for tuple or list items."""
+        """Test error handling for multiple non-numbers."""
         with self.assertRaisesRegex(ValueError, "invalid literal for int\(\) 
with base 10: 'drei'"):
             self.assertEqual(
                 i18n.twntranslate('de', 'test-multiple-plurals', ["drei", "1", 
1])
diff --git a/tests/interwiki_link_tests.py b/tests/interwiki_link_tests.py
index 2b34015..61e8ae4 100644
--- a/tests/interwiki_link_tests.py
+++ b/tests/interwiki_link_tests.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8  -*-
+"""Test Interwiki Link functionality."""
 #
 # (C) Pywikipedia bot team, 2014
 #
@@ -14,6 +15,8 @@
 
 class TestPartiallyQualifiedLinkDifferentCodeParser(TestCase):
 
+    """Tests for interwiki links to local sites."""
+
     family = 'wikipedia'
     code = 'en'
     cached = True
diff --git a/tests/ipregex_tests.py b/tests/ipregex_tests.py
index 0498561..cf61a19 100644
--- a/tests/ipregex_tests.py
+++ b/tests/ipregex_tests.py
@@ -1,4 +1,5 @@
 #!/usr/bin/python
+"""Test IP regex."""
 # -*- coding: utf-8  -*-
 #
 # (C) Pywikibot team, 2014
diff --git a/tests/link_tests.py b/tests/link_tests.py
index b1ca6d0..0e37551 100644
--- a/tests/link_tests.py
+++ b/tests/link_tests.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8  -*-
+"""Test Link functionality."""
 #
 # (C) Pywikipedia bot team, 2014
 #
@@ -16,6 +17,8 @@
 
 
 class TestPartiallyQualifiedExplicitLinkSameSiteParser(TestCase):
+
+    """Link tests."""
 
     family = 'wikipedia'
     code = 'en'
@@ -72,6 +75,8 @@
 
 class TestPartiallyQualifiedExplicitLinkDifferentCodeParser(TestCase):
 
+    """Link tests."""
+
     family = 'wikipedia'
     code = 'en'
     cached = True
@@ -106,6 +111,8 @@
 
 
 class TestPartiallyQualifiedExplicitLinkDifferentFamilyParser(TestCase):
+
+    """Link tests."""
 
     family = 'wikipedia'
     code = 'en'
@@ -142,6 +149,8 @@
 
 class TestFullyQualifiedSameNamespaceFamilyParser(TestCase):
 
+    """Link tests."""
+
     family = 'wikipedia'
     code = 'en'
     cached = True
@@ -163,6 +172,8 @@
 
 
 class TestFullyQualifiedExplicitLinkSameFamilyParser(TestCase):
+
+    """Link tests."""
 
     family = 'wikipedia'
     code = 'en'
@@ -190,6 +201,8 @@
 
 
 class TestFullyQualifiedExplicitLinkDifferentFamilyParser(TestCase):
+
+    """Link tests."""
 
     sites = {
         'enws': {
@@ -246,6 +259,8 @@
 
 class TestFullyQualifiedExplicitLinkNoLangConfigFamilyParser(TestCase):
 
+    """Link tests."""
+
     sites = {
         'wikidata': {
             'family': 'wikidata',
@@ -300,6 +315,8 @@
 
 
 class TestFullyQualifiedNoLangFamilyExplicitLinkParser(TestCase):
+
+    """Link tests."""
 
     sites = {
         'wikidata': {
@@ -360,6 +377,8 @@
 
 class TestFullyQualifiedOneSiteFamilyExplicitLinkParser(TestCase):
 
+    """Link tests."""
+
     family = 'species'
     code = 'species'
     cached = True
@@ -389,6 +408,8 @@
 
 
 class TestPartiallyQualifiedImplicitLinkSameSiteParser(TestCase):
+
+    """Link tests."""
 
     family = 'wikipedia'
     code = 'en'
@@ -445,6 +466,8 @@
 
 class TestPartiallyQualifiedImplicitLinkDifferentCodeParser(TestCase):
 
+    """Link tests."""
+
     family = 'wikipedia'
     code = 'en'
     cached = True
@@ -479,6 +502,8 @@
 
 
 class TestPartiallyQualifiedImplicitLinkDifferentFamilyParser(TestCase):
+
+    """Link tests."""
 
     family = 'wikipedia'
     code = 'en'
@@ -515,6 +540,8 @@
 
 class TestFullyQualifiedImplicitLinkSameFamilyParser(TestCase):
 
+    """Link tests."""
+
     family = 'wikipedia'
     code = 'en'
     cached = True
@@ -541,6 +568,8 @@
 
 
 class TestFullyQualifiedImplicitLinkDifferentFamilyParser(TestCase):
+
+    """Link tests."""
 
     sites = {
         'enws': {
@@ -597,6 +626,8 @@
 
 class TestFullyQualifiedImplicitLinkNoLangConfigFamilyParser(TestCase):
 
+    """Link tests."""
+
     sites = {
         'wikidata': {
             'family': 'wikidata',
@@ -652,6 +683,8 @@
 
 class TestFullyQualifiedNoLangFamilyImplicitLinkParser(TestCase):
 
+    """Link tests."""
+
     family = 'wikidata'
     code = 'test'
     cached = True
@@ -699,6 +732,8 @@
 
 class TestFullyQualifiedOneSiteFamilyImplicitLinkParser(TestCase):
 
+    """Link tests."""
+
     family = 'species'
     code = 'species'
     cached = True
diff --git a/tests/page_tests.py b/tests/page_tests.py
index c5213f5..f3bcb0f 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -96,7 +96,7 @@
                 ]
 
     def testNamespaces(self):
-        """Test that Link() normalizes namespace names"""
+        """Test that Link() normalizes namespace names."""
         for num in self.namespaces:
             for prefix in self.namespaces[num]:
                 l = pywikibot.page.Link(prefix + list(self.titles.keys())[0],
@@ -108,7 +108,7 @@
                 self.assertEqual(m.namespace, num)
 
     def testTitles(self):
-        """Test that Link() normalizes titles"""
+        """Test that Link() normalizes titles."""
         for title in self.titles:
             for num in (0, 1):
                 l = pywikibot.page.Link(self.namespaces[num][0] + title,
@@ -158,6 +158,8 @@
 
 
 class TestPageObjectEnglish(TestCase):
+
+    """Test Page Object using English Wikipedia."""
 
     family = 'wikipedia'
     code = 'en'
@@ -252,15 +254,17 @@
 
 class TestPageObject(DefaultSiteTestCase):
 
+    """Test Page object."""
+
     cached = True
 
     def testSite(self):
-        """Test site() method"""
+        """Test site() method."""
         mainpage = self.get_mainpage()
         self.assertEqual(mainpage.site, self.site)
 
     def testNamespace(self):
-        """Test namespace() method"""
+        """Test namespace() method."""
         mainpage = self.get_mainpage()
         maintalk = mainpage.toggleTalkPage()
 
@@ -378,9 +382,7 @@
         self.assertIsInstance(mainpage.purge(), bool)
 
     def testIsDisambig(self):
-        """
-        Test the integration with Extension:Disambiguator.
-        """
+        """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')
@@ -496,6 +498,8 @@
 
 class TestPageRedirects(TestCase):
 
+    """Test redirects."""
+
     family = 'wikipedia'
     code = 'en'
 
@@ -522,13 +526,15 @@
 
 class TestCategoryObject(TestCase):
 
+    """Test Category object."""
+
     family = 'wikipedia'
     code = 'en'
 
     cached = True
 
     def test_isEmptyCategory(self):
-        """Test if category is empty or not"""
+        """Test if category is empty or not."""
         site = self.get_site()
         cat_empty = pywikibot.Category(site, u'Category:foooooo')
         cat_not_empty = pywikibot.Category(site, u'Category:Wikipedia 
categories')
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index f7f372c..0445f09 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1,4 +1,5 @@
 #!/usr/bin/python
+"""Test pagegenerators module."""
 # -*- coding: utf-8  -*-
 #
 # (C) Pywikibot team, 2014
diff --git a/tests/pwb_tests.py b/tests/pwb_tests.py
index 109505e..883d4f4 100644
--- a/tests/pwb_tests.py
+++ b/tests/pwb_tests.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8  -*-
+"""Test pwb.py."""
 #
 # (C) Pywikibot team, 2007-2014
 #
@@ -20,6 +21,7 @@
 
 
 def check_output(command):
+    """Execute and return the output of a command."""
     return subprocess.Popen(command, stdout=subprocess.PIPE).communicate()[0]
 
 
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 90d4f9f..4d78683 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -1453,6 +1453,8 @@
 
 class TestWiktionarySite(TestCase):
 
+    """Test Site Object on English Wiktionary."""
+
     family = 'wiktionary'
     code = 'en'
 
@@ -1468,6 +1470,8 @@
 
 
 class TestNonEnglishWikipediaSite(TestCase):
+
+    """Test Site Object on Nynorsk Wikipedia."""
 
     family = 'wikipedia'
     code = 'nn'
@@ -1495,6 +1499,8 @@
 
 class TestUploadEnabledSite(TestCase):
 
+    """Test Site.is_uploaddisabled."""
+
     sites = {
         'wikidatatest': {
             'family': 'wikidata',
diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py
index cafa378..73b1a59 100644
--- a/tests/textlib_tests.py
+++ b/tests/textlib_tests.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8  -*-
+"""Test textlib module."""
 #
 # (C) Pywikibot team, 2007-2014
 #
@@ -29,6 +30,8 @@
 
 
 class TestSectionFunctions(TestCase):
+
+    """Test wikitext section handling function."""
 
     net = False
 
@@ -95,6 +98,8 @@
 
 class TestFormatFunctions(TestCase):
 
+    """Test format functions."""
+
     family = 'wikipedia'
     code = 'en'
 
@@ -142,8 +147,9 @@
 class TestCategoryRearrangement(TestCase):
 
     """
-    Tests to ensure that sorting keys are not being lost when
-    using .getCategoryLinks() and .replaceCategoryLinks(),
+    Ensure that sorting keys are not being lost.
+
+    Tests .getCategoryLinks() and .replaceCategoryLinks(),
     with both a newline and an empty string as separators.
     """
 
diff --git a/tests/timestripper_tests.py b/tests/timestripper_tests.py
index 6c31248..54af2a0 100644
--- a/tests/timestripper_tests.py
+++ b/tests/timestripper_tests.py
@@ -23,6 +23,7 @@
     cached = True
 
     def setUp(self):
+        """Set up test cases."""
         super(TestTimeStripperWithNoDigitsAsMonths, self).setUp()
         self.ts = TimeStripper(self.get_site())
 
@@ -86,7 +87,7 @@
 
 class TestTimeStripperWithDigitsAsMonths(TestCase):
 
-    """Test cases for TimeStripper methods"""
+    """Test cases for TimeStripper methods."""
 
     family = 'wikipedia'
     code = 'cs'
@@ -125,7 +126,7 @@
 
 class TestTimeStripperLanguage(TestCase):
 
-    """Test cases for English language"""
+    """Test cases for English language."""
 
     sites = {
         'cswiki': {
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index eb2655e..e5a053e 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -40,16 +40,19 @@
     import threading
 
     class pywikibotWrapper(object):
+
+        """pywikibot wrapper class."""
+
         def init(self):
-            import pywikibot
+            import pywikibot  # noqa
             pywikibot.version._get_program_dir()
 
         def output(self, *args, **kwargs):
-            import pywikibot
+            import pywikibot  # noqa
             return pywikibot.output(*args, **kwargs)
 
         def request_input(self, *args, **kwargs):
-            import pywikibot
+            import pywikibot  # noqa
             self.input = None
 
             def threadedinput():
@@ -62,17 +65,20 @@
             return self.input
 
         def set_config(self, key, value):
-            import pywikibot
+            import pywikibot  # noqa
             setattr(pywikibot.config, key, value)
 
         def set_ui(self, key, value):
-            import pywikibot
+            import pywikibot  # noqa
             setattr(pywikibot.ui, key, value)
 
         def cls(self):
             os.system('cls')
 
     class pywikibotManager(BaseManager):
+
+        """pywikibot manager class."""
+
         pass
 
     pywikibotManager.register('pywikibot', pywikibotWrapper)
@@ -91,11 +97,13 @@
     newstdin = StringIO()
 
     def patch():
+        """Patch standard terminal files."""
         sys.stdout = newstdout
         sys.stderr = newstderr
         sys.stdin = newstdin
 
     def unpatch():
+        """un-patch standard terminal files."""
         sys.stdout = oldstdout
         sys.stderr = oldstderr
         sys.stdin = oldstdin
@@ -115,6 +123,9 @@
                       'newline': "\n"}
 
     class UITestCase(unittest.TestCase):
+
+        """UI tests."""
+
         def setUp(self):
             patch()
             newstdout.truncate(0)
@@ -130,6 +141,9 @@
             unpatch()
 
     class TestTerminalOutput(UITestCase):
+
+        """Terminal output tests."""
+
         def testOutputLevels_logging_debug(self):
             logger.log(DEBUG, 'debug', extra=loggingcontext)
             self.assertEqual(newstdout.getvalue(), "")
@@ -232,6 +246,9 @@
             self.assertNotEqual(stderrlines[-1], "\n")
 
     class TestTerminalInput(UITestCase):
+
+        """Terminal input tests."""
+
         def testInput(self):
             newstdin.write("input to read\n")
             newstdin.seek(0)
@@ -295,6 +312,9 @@
 
     @unittest.skipUnless(os.name == "posix", "requires Unix console")
     class TestTerminalOutputColorUnix(UITestCase):
+
+        """Terminal output color tests."""
+
         def testOutputColorizedText(self):
             pywikibot.output(u"normal text \03{lightpurple}light purple 
text\03{default} normal text")
             self.assertEqual(newstdout.getvalue(), "")
@@ -313,13 +333,16 @@
             self.assertEqual(newstderr.getvalue(), "normal text \x1b[35;1m 
light purple \x1b[94;1m light blue \x1b[35;1m light purple \x1b[0m normal 
text\n\x1b[0m")
 
         def testOutputColorCascade_incorrect(self):
-            ''' This test documents current (incorrect) behavior '''
+            """ Test incorrect behavior of testOutputColorCascade. """
             pywikibot.output(u"normal text \03{lightpurple} light purple 
\03{lightblue} light blue \03{default} light purple \03{default} normal text")
             self.assertEqual(newstdout.getvalue(), "")
             self.assertEqual(newstderr.getvalue(), "normal text \x1b[35;1m 
light purple \x1b[94;1m light blue \x1b[0m light purple \x1b[0m normal 
text\n\x1b[0m")
 
     @unittest.skipUnless(os.name == "posix", "requires Unix console")
     class TestTerminalUnicodeUnix(UITestCase):
+
+        """Terminal output tests for unix."""
+
         def testOutputUnicodeText(self):
             pywikibot.output(u"Заглавная_страница")
             self.assertEqual(newstdout.getvalue(), "")
@@ -339,6 +362,9 @@
 
     @unittest.skipUnless(os.name == "posix", "requires Unix console")
     class TestTransliterationUnix(UITestCase):
+
+        """Terminal output transliteration tests."""
+
         def testOutputTransliteratedUnicodeText(self):
             pywikibot.ui.encoding = 'latin-1'
             pywikibot.config.transliterate = True
@@ -348,6 +374,9 @@
 
     @unittest.skipUnless(os.name == "nt", "requires Windows console")
     class WindowsTerminalTestCase(UITestCase):
+
+        """MS Windows terminal tests."""
+
         @classmethod
         def setUpProcess(cls, command):
             import pywinauto
@@ -412,6 +441,9 @@
             self._app.window_().TypeKeys('% 
{UP}{UP}{UP}{RIGHT}{DOWN}{DOWN}{ENTER}', with_spaces=True)
 
     class TestWindowsTerminalUnicode(WindowsTerminalTestCase):
+
+        """MS Windows terminal unicode tests."""
+
         @classmethod
         def setUpClass(cls):
             import inspect
@@ -458,6 +490,9 @@
             self.assertEqual(returned, u"Заглавная_страница")
 
     class TestWindowsTerminalUnicodeArguments(WindowsTerminalTestCase):
+
+        """MS Windows terminal unicode argument tests."""
+
         @classmethod
         def setUpClass(cls):
             cls.setUpProcess(["cmd", "/k", "echo off"])
@@ -488,6 +523,9 @@
 
 else:
     class TestTerminalUI(unittest.TestCase):
+
+        """Class to show all tests skipped under unittest."""
+
         @unittest.skip("Terminal UI tests can only be run by directly running 
tests/ui_tests.py")
         def testCannotBeRun(self):
             pass
diff --git a/tests/weblib_tests.py b/tests/weblib_tests.py
index 5a00dd0..14e338a 100644
--- a/tests/weblib_tests.py
+++ b/tests/weblib_tests.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8  -*-
+"""Weblib test module."""
 #
 # (C) Pywikibot team, 2014
 #
@@ -19,6 +20,8 @@
 
 class TestArchiveSites(TestCase):
 
+    """Test weblib methods to access archive websites."""
+
     net = True
 
     @classmethod
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index f41640e..5ba2cbd 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -23,6 +23,7 @@
 # fetch a page which is very likely to be unconnected, which doesnt have
 # a generator, and unit tests may be used to test old versions of pywikibot
 def _get_test_unconnected_page(site):
+    """Get unconnected page from site for tests."""
     gen = pagegenerators.NewpagesPageGenerator(site=site, total=10,
                                                namespaces=[1, ])
     for page in gen:
@@ -31,6 +32,8 @@
 
 
 class TestGeneral(WikidataTestCase):
+
+    """General Wikibase tests."""
 
     @classmethod
     def setUpClass(cls):
@@ -429,6 +432,8 @@
 
 class TestPropertyPage(WikidataTestCase):
 
+    """Test PropertyPage."""
+
     def test_property_empty_property(self):
         """Test creating a PropertyPage without a title."""
         wikidata = self.get_repo()
@@ -468,6 +473,8 @@
 
 
 class TestClaimSetValue(WikidataTestCase):
+
+    """Test setting claim values."""
 
     def test_set_website(self):
         wikidata = self.get_repo()
@@ -803,6 +810,8 @@
 
 class TestOwnClient(TestCase):
 
+    """Test that a data repository family can be its own client."""
+
     sites = {
         # The main Wikidata is its own client.
         'wikidata': {
diff --git a/tests/wikidataquery_tests.py b/tests/wikidataquery_tests.py
index ecfe70a..4c3b018 100644
--- a/tests/wikidataquery_tests.py
+++ b/tests/wikidataquery_tests.py
@@ -21,9 +21,7 @@
 
 class TestApiFunctions(WikidataTestCase):
 
-    def setUp(self):
-        super(TestApiFunctions, self).setUp()
-        self.repo = self.get_repo()
+    """Test WikiDataQuery API functions."""
 
     def testQueries(self):
         """
@@ -93,7 +91,7 @@
         self.assertEqual(str(q), "claim[99:(tree[1][2,5][3,90])]")
 
     def testQueriesWDStructures(self):
-        """Queries using Wikibase page structures like ItemPage."""
+        """Test queries using Wikibase page structures like ItemPage."""
         q = query.HasClaim(PropertyPage(self.repo, "P99"))
         self.assertEqual(str(q), "claim[99]")
 
@@ -217,6 +215,8 @@
 
 class TestApiSlowFunctions(TestCase):
 
+    """Test slow WikiDataQuery API functions."""
+
     net = True
 
     def testQueryApiGetter(self):
diff --git a/tests/xmlreader_tests.py b/tests/xmlreader_tests.py
index 292be70..8399d0a 100644
--- a/tests/xmlreader_tests.py
+++ b/tests/xmlreader_tests.py
@@ -16,6 +16,8 @@
 
 class XmlReaderTestCase(TestCase):
 
+    """XML Reader test cases."""
+
     net = False
 
     def test_XmlDumpAllRevs(self):
diff --git a/tox.ini b/tox.ini
index f722b37..894665d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -59,14 +59,8 @@
     ./scripts/illustrate_wikidata.py \
     ./scripts/newitem.py \
     ./scripts/pagefromfile.py \
-    ./tests/aspects.py \
-    ./tests/deprecation_tests.py \
-    ./tests/api_tests.py \
-    ./tests/dry_api_tests.py \
-    ./tests/dry_site_tests.py \
-    ./tests/family_tests.py \
     ./scripts/maintenance/cache.py \
-    ./tests/upload_tests.py
+    ./tests/*.py
 
 deps = flake8-docstrings
 

-- 
To view, visit https://gerrit.wikimedia.org/r/167192
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a3254fc48090b50f68c89a81a7d35f29edb4d25
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jay...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to