From a14630be3a9587a8c994382ee6550b51b32b0655 Mon Sep 17 00:00:00 2001
From: labrys <labrys@useres.noreply.github.com>
Date: Fri, 27 Nov 2015 15:48:23 -0500
Subject: [PATCH] Lint 10/10

---
 tests/all_tests.py | 60 +++++++++++++++++++++++++++++++++++++---------
 1 file changed, 49 insertions(+), 11 deletions(-)

diff --git a/tests/all_tests.py b/tests/all_tests.py
index de388878e..ca1533cfc 100755
--- a/tests/all_tests.py
+++ b/tests/all_tests.py
@@ -18,49 +18,83 @@
 # You should have received a copy of the GNU General Public License
 # along with SickRage.  If not, see <http://www.gnu.org/licenses/>.
 
+# pylint: disable=line-too-long
+
+"""
+Perform all tests in tests/
+"""
+
+
 import fnmatch
 import os
 import sys
 import unittest
 
-tests_dir = os.path.abspath(__file__)[:-len(os.path.basename(__file__))]
 
-sys.path.insert(1, os.path.join(tests_dir, '../lib'))
-sys.path.insert(1, os.path.join(tests_dir, '..'))
+TESTS_DIR = os.path.abspath(__file__)[:-len(os.path.basename(__file__))]
+
+sys.path.insert(1, os.path.join(TESTS_DIR, '../lib'))
+sys.path.insert(1, os.path.join(TESTS_DIR, '..'))
 
 
 class AllTests(unittest.TestCase):
+    """
+    Performs all tests in tests directory.
+
+    Methods
+        setUp
+        test_all
+        _get_module_strings
+        _get_test_files
+        _get_test_suites
+    """
     # Block issue_submitter_tests to avoid issue tracker spam on every build
-    blacklist = [tests_dir + 'all_tests.py', tests_dir + 'issue_submitter_tests.py', tests_dir + 'search_tests.py']
+    blacklist = [TESTS_DIR + 'all_tests.py', TESTS_DIR + 'issue_submitter_tests.py', TESTS_DIR + 'search_tests.py']
 
     def setUp(self):
+        """
+        Get all tests
+        """
         self.test_file_strings = self._get_test_files()
         self.module_strings = self._get_module_strings()
         self.suites = self._get_test_suites()
-        self.testSuite = unittest.TestSuite(self.suites)
+        self.test_suite = unittest.TestSuite(self.suites)
 
-    def testAll(self):
+    def test_all(self):
+        """
+        Perform all tests
+        """
         print "===================="
         print "STARTING - ALL TESTS"
         print "===================="
 
         for included_files in self.test_file_strings:
-            print "- " + included_files[len(tests_dir):-3]
+            print "- " + included_files[len(TESTS_DIR):-3]
 
-        text_runner = unittest.TextTestRunner().run(self.testSuite)
+        text_runner = unittest.TextTestRunner().run(self.test_suite)
         if not text_runner.wasSuccessful():
             sys.exit(-1)
 
     def _get_module_strings(self):
+        """
+        Convert the file names into module names
+
+        :return: all module names
+        """
         modules = []
         for file_string in self.test_file_strings:
-            modules.append(file_string[len(tests_dir):len(file_string) - 3].replace(os.sep, '.'))
+            modules.append(file_string[len(TESTS_DIR):len(file_string) - 3].replace(os.sep, '.'))
 
         return modules
 
     def _get_test_files(self):
+        """
+        Get the name of all the tests in the tests directory
+
+        :return: all file names that match
+        """
         matches = []
-        for root, _, file_names in os.walk(tests_dir):
+        for root, _, file_names in os.walk(TESTS_DIR):
             for filename in fnmatch.filter(file_names, '*_tests.py'):
                 filename_with_path = os.path.join(root, filename)
 
@@ -70,8 +104,12 @@ class AllTests(unittest.TestCase):
         return matches
 
     def _get_test_suites(self):
-        return [unittest.defaultTestLoader.loadTestsFromName(file_string) for file_string in self.module_strings]
+        """
+        Load all test suites
 
+        :return: all test suites from tests
+        """
+        return [unittest.defaultTestLoader.loadTestsFromName(file_string) for file_string in self.module_strings]
 
 if __name__ == "__main__":
     unittest.main()
-- 
GitLab