avoid some pylint warnings
Hanno Böck

Hanno Böck commited on 2019-12-14 09:46:03
Zeige 2 geänderte Dateien mit 6 Einfügungen und 7 Löschungen.

... ...
@@ -24,16 +24,16 @@ class TestFreewvsData(unittest.TestCase):
24 24
                             tmp + "/freewvs-testdata"],
25 25
                            check=True)
26 26
 
27
-        for dir in glob.glob(tmp + "/freewvs-testdata/webapps/*"):
28
-            bdir = os.path.basename(dir)
29
-            for tarball in glob.glob(dir + "/dist/*"):
27
+        for tdir in glob.glob(tmp + "/freewvs-testdata/webapps/*"):
28
+            bdir = os.path.basename(tdir)
29
+            for tarball in glob.glob(tdir + "/dist/*"):
30 30
                 shutil.unpack_archive(tarball, "%s/%s/%s-src"
31 31
                                       % (tmp, bdir, os.path.basename(tarball)))
32 32
             fwrun = subprocess.run(["./freewvs", "-a", tmp + "/" + bdir],
33 33
                                    stdout=subprocess.PIPE, check=True)
34 34
             fwdata = re.sub(tmp, "[dir]", fwrun.stdout.decode("utf-8"))
35 35
             fwclean = re.sub(r' \(.* ', " ", fwdata)
36
-            f = open(dir + "/refdata-a.txt")
36
+            f = open(tdir + "/refdata-a.txt")
37 37
             refdata = f.read()
38 38
             f.close()
39 39
             refclean = re.sub(r' \(.* ', " ", refdata)
... ...
@@ -17,12 +17,11 @@ class TestJsonLint(unittest.TestCase):
17 17
             fp.close()
18 18
             tmp = json.loads(orig)
19 19
             new = json.dumps(tmp, indent=2)
20
-            if (orig != new):
20
+            if orig != new:
21 21
                 print("json %s not valid" % f)
22 22
                 sys.stdout.writelines(difflib.unified_diff(orig, new))
23 23
                 valid = False
24
-        if not valid:
25
-            raise Exception("Unlinted json files found")
24
+        self.assertTrue(valid)
26 25
 
27 26
 
28 27
 if __name__ == '__main__':
29 28