From abab67f9a542153011b4825d00d0d29941bac064 Mon Sep 17 00:00:00 2001
From: Andrei Savici <saviciat@ornl.gov>
Date: Fri, 17 Apr 2015 15:32:38 -0400
Subject: [PATCH] pylint stuff. refs #11585

---
 .../tests/analysis/BuildSQWTest.py            | 16 ++++-----
 .../tests/analysis/CodeConventions.py         | 33 ++++++++++---------
 .../analysis/POLDIAnalyseResidualsTest.py     |  4 +--
 3 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/BuildSQWTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/BuildSQWTest.py
index f97d908b12a..99e7da59897 100644
--- a/Code/Mantid/Testing/SystemTests/tests/analysis/BuildSQWTest.py
+++ b/Code/Mantid/Testing/SystemTests/tests/analysis/BuildSQWTest.py
@@ -88,7 +88,7 @@ class BuildSQWTest(stresstesting.MantidStressTest):
 
         # Do the final merge
         sqw_file = os.path.join(config["defaultsave.directory"],"BuildSQWTestCurrent.nxs")
-        finalSQW = MergeMDFiles(",".join(self._created_files),OutputFilename=sqw_file,Parallel='0')
+        dummy_finalSQW = MergeMDFiles(",".join(self._created_files),OutputFilename=sqw_file,Parallel='0')
         self._created_files.append(sqw_file)
 
     def validate(self):
@@ -101,14 +101,14 @@ class BuildSQWTest(stresstesting.MantidStressTest):
         for filename in self._created_files:
             try:
                 os.remove(filename)
-            except OSError,exc:
+            except OSError:
                 mantid.logger.warning("Unable to remove created file '%s'" % filename)
 
 class LoadSQW_FileBasedTest(BuildSQWTest):
     """ The test checks loading MD workspace from SQW file when target file is file based"""
 
     def __init__(self):
-
+        super(LoadSQW_FileBasedTest, self).__init__()
         self._input_data = ["Test22meV2f.sqw","Test22meVMD.nxs"]
 
     def runTest(self):
@@ -116,7 +116,7 @@ class LoadSQW_FileBasedTest(BuildSQWTest):
         MDws_file = os.path.join(config["defaultsave.directory"],"LoadSQWTestFileBased.nxs")
         sqw_file = os.path.join(self._input_location,self._input_data[0])
 
-        wsMD=LoadSQW(Filename=sqw_file, OutputFilename=MDws_file)
+        dummy_wsMD=LoadSQW(Filename=sqw_file, OutputFilename=MDws_file)
 
         self._created_files=MDws_file
 
@@ -127,7 +127,7 @@ class LoadSQW_FileBasedTest(BuildSQWTest):
         Reference=LoadMD(Filename=ref_file, FileBackEnd=True, Memory=100)
         rez = CompareMDWorkspaces(Workspace1="wsMD",Workspace2=Reference,Tolerance=1.e-5,CheckEvents=False,IgnoreBoxID=False)
 
-        DeleteWorkspace("wsMD")
+        DeleteWorkspace("dummy_wsMD")
 
         return rez[0]
 
@@ -135,14 +135,14 @@ class LoadSQW_MemBasedTest(BuildSQWTest):
     """ The test checks loading MD workspace from SQW file when target file is file based"""
 
     def __init__(self):
-
+        super(LoadSQW_MemBasedTest, self).__init__()
         self._input_data = ["Test22meV2f.sqw","Test22meVMD.nxs"]
 
     def runTest(self):
 
         sqw_file = os.path.join(self._input_location,self._input_data[0])
 
-        wsMD=LoadSQW(Filename=sqw_file)
+        dummy_wsMD=LoadSQW(Filename=sqw_file)
 
         self._created_files=[]
 
@@ -153,6 +153,6 @@ class LoadSQW_MemBasedTest(BuildSQWTest):
         Reference=LoadMD(Filename=ref_file, FileBackEnd=True, Memory=100)
         rez = CompareMDWorkspaces(Workspace1="wsMD",Workspace2=Reference,Tolerance=1.e-5,CheckEvents=False,IgnoreBoxID=False)
 
-        DeleteWorkspace("wsMD")
+        DeleteWorkspace("dummy_wsMD")
 
         return rez[0]
diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/CodeConventions.py b/Code/Mantid/Testing/SystemTests/tests/analysis/CodeConventions.py
index ed1ab76ceec..6e101eebcd5 100644
--- a/Code/Mantid/Testing/SystemTests/tests/analysis/CodeConventions.py
+++ b/Code/Mantid/Testing/SystemTests/tests/analysis/CodeConventions.py
@@ -8,7 +8,7 @@ MAX_ALG_LEN = 40 # TODO convention says 20 is the maximum
 
 SPECIAL = ["InputWorkspace", "OutputWorkspace", "Workspace",
            "ReductionProperties"]
-SPECIAL_UPPER = [name.upper for name in SPECIAL]
+SPECIAL_UPPER = [specialname.upper for specialname in SPECIAL]
 
 # TODO this list should be empty
 ALG_BAD_PARAMS = {
@@ -29,10 +29,10 @@ ALG_BAD_PARAMS = {
     "PoldiRemoveDeadWires(v1)":("nbExcludedWires", "nbAuteDeadWires"),
     "SaveIsawQvector(v1)":("Qx_vector", "Qy_vector", "Qz_vector"),
     "SCDCalibratePanels(v1)":("a", "b", "c", "alpha", "beta", "gamma",
-                          "useL0", "usetimeOffset", "usePanelWidth",
-                          "usePanelHeight", "usePanelPosition",
-                          "usePanelOrientation", "tolerance",
-                          "MaxPositionChange_meters"),
+                              "useL0", "usetimeOffset", "usePanelWidth",
+                              "usePanelHeight", "usePanelPosition",
+                              "usePanelOrientation", "tolerance",
+                              "MaxPositionChange_meters"),
     "SetSampleMaterial(v1)":("bAverage", "bSquaredAverage"),
     "SetUB(v1)":("a", "b", "c", "alpha", "beta", "gamma", "u", "v"),
     "ViewBOA(v1)":("CD-Distance"),
@@ -61,6 +61,13 @@ FUNC_BAD_PARAMS = {
     }
 
 class Algorithms(stresstesting.MantidStressTest):
+
+    def __init__(self):
+        self.__ranOk = 0
+        self.algRegExp = re.compile(r'^[A-Z][a-zA-Z0-9]+$')
+        self.paramRegExp = re.compile(r'^[A-Z][a-zA-Z0-9]*$')
+        self.categoryRegExp = re.compile(r'^([A-Z][a-zA-Z]+\\?)+$')
+
     def verifyAlgName(self, name):
         if not self.algRegExp.match(name):
             print "Algorithm " + name + " has a name that violates conventions"
@@ -108,11 +115,6 @@ class Algorithms(stresstesting.MantidStressTest):
         return True
 
     def runTest(self):
-        self.__ranOk = 0
-        self.algRegExp = re.compile(r'^[A-Z][a-zA-Z0-9]+$')
-        self.paramRegExp = re.compile(r'^[A-Z][a-zA-Z0-9]*$')
-        self.categoryRegExp = re.compile(r'^([A-Z][a-zA-Z]+\\?)+$')
-
         algs = AlgorithmFactory.getRegisteredAlgorithms(True)
 
         for (name, versions) in algs.iteritems():
@@ -144,6 +146,12 @@ class Algorithms(stresstesting.MantidStressTest):
         return True
 
 class FitFunctions(stresstesting.MantidStressTest):
+    def __init__(self):
+        self.__ranOk = 0
+        self.funcRegExp = re.compile(r'^[A-Z][a-zA-Z0-9]+$')
+        self.paramRegExp = re.compile(r'^[A-Z][a-zA-Z0-9]*$')
+        self.categoryRegExp = re.compile(r'^([A-Z][a-zA-Z]+\\?)+$')
+
     def verifyFuncName(self, name):
         if name in FUNC_BAD_NAME:
             return True
@@ -192,11 +200,6 @@ class FitFunctions(stresstesting.MantidStressTest):
         return True
 
     def runTest(self):
-        self.__ranOk = 0
-        self.funcRegExp = re.compile(r'^[A-Z][a-zA-Z0-9]+$')
-        self.paramRegExp = re.compile(r'^[A-Z][a-zA-Z0-9]*$')
-        self.categoryRegExp = re.compile(r'^([A-Z][a-zA-Z]+\\?)+$')
-
         functions = mantid.api.FunctionFactory.getFunctionNames()
         for name in functions:
             if not self.verifyFuncName(name):
diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIAnalyseResidualsTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIAnalyseResidualsTest.py
index 43807ffb1be..ca747f13f2e 100644
--- a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIAnalyseResidualsTest.py
+++ b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIAnalyseResidualsTest.py
@@ -48,7 +48,7 @@ class POLDIAnalyseResidualsTest(stresstesting.MantidStressTest):
             self.assertDelta(slope, 1.0, 1e-2, "Slope is larger than 1.0 for %s (is: %d)" % (dataFile, slope))
 
             relativeSlopeError = fitResult.cell(1, 2) / slope
-            self.assertLessThan(relativeSlopeError, 5e-3, 
+            self.assertLessThan(relativeSlopeError, 5e-3,
                                 "Relative error of slope is too large for %s (is: %d)" % (dataFile, relativeSlopeError))
 
             intercept = fitResult.cell(0, 1)
@@ -56,5 +56,5 @@ class POLDIAnalyseResidualsTest(stresstesting.MantidStressTest):
 
             residuals = mtd[fitNameTemplate + "_Workspace"].dataY(2)
             maxAbsoluteResidual = np.max(np.abs(residuals))
-            self.assertLessThan(maxAbsoluteResidual, 1.0, 
+            self.assertLessThan(maxAbsoluteResidual, 1.0,
                                 "Maximum absolute residual is too large for %s (is: %d)" % (dataFile, maxAbsoluteResidual))
-- 
GitLab