Browse code

fix new pylint warnings

Hanno Böck authored on05/09/2021 09:46:29
Showing1 changed files
... ...
@@ -33,7 +33,7 @@ class TestFreewvsData(unittest.TestCase):
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(tdir + "/refdata-a.txt")
36
+            f = open(tdir + "/refdata-a.txt", encoding="ascii")
37 37
             refdata = f.read()
38 38
             f.close()
39 39
             refclean = re.sub(r' \(.* ', " ", refdata)
Browse code

accidentally disabled most repo tests, reenable + fix codingstyle

Hanno Böck authored on09/06/2020 19:47:42
Showing1 changed files
... ...
@@ -24,8 +24,7 @@ class TestFreewvsData(unittest.TestCase):
24 24
                             tmp + "/testdata"],
25 25
                            check=True)
26 26
 
27
-        #for tdir in glob.glob(tmp + "/testdata/webapps/*"):
28
-        if 0:
27
+        for tdir in glob.glob(tmp + "/testdata/webapps/*"):
29 28
             bdir = os.path.basename(tdir)
30 29
             for tarball in glob.glob(tdir + "/dist/*"):
31 30
                 shutil.unpack_archive(tarball, "%s/%s/%s-src"
Browse code

fix test - wrong bdir var here

Hanno Böck authored on09/06/2020 19:44:41
Showing1 changed files
... ...
@@ -24,7 +24,8 @@ class TestFreewvsData(unittest.TestCase):
24 24
                             tmp + "/testdata"],
25 25
                            check=True)
26 26
 
27
-        for tdir in glob.glob(tmp + "/testdata/webapps/*"):
27
+        #for tdir in glob.glob(tmp + "/testdata/webapps/*"):
28
+        if 0:
28 29
             bdir = os.path.basename(tdir)
29 30
             for tarball in glob.glob(tdir + "/dist/*"):
30 31
                 shutil.unpack_archive(tarball, "%s/%s/%s-src"
... ...
@@ -45,7 +46,7 @@ class TestFreewvsData(unittest.TestCase):
45 46
                              msg="Output in %s does not match" % bdir)
46 47
 
47 48
         # misc tests, for read errors, garbage data etc.
48
-        subprocess.run(["./freewvs", "-a", tmp + "/testdata/misc/" + bdir],
49
+        subprocess.run(["./freewvs", "-a", tmp + "/testdata/misc/"],
49 50
                        stdout=subprocess.PIPE, check=True)
50 51
 
51 52
 
Browse code

run misc tests from testdata repo

Hanno Böck authored on09/06/2020 19:36:37
Showing1 changed files
... ...
@@ -44,6 +44,10 @@ class TestFreewvsData(unittest.TestCase):
44 44
             self.assertEqual(refclean, fwclean,
45 45
                              msg="Output in %s does not match" % bdir)
46 46
 
47
+        # misc tests, for read errors, garbage data etc.
48
+        subprocess.run(["./freewvs", "-a", tmp + "/testdata/misc/" + bdir],
49
+                       stdout=subprocess.PIPE, check=True)
50
+
47 51
 
48 52
 if __name__ == '__main__':
49 53
     unittest.main()
Browse code

make test var names more generic

Hanno Böck authored on03/05/2020 13:26:39
Showing1 changed files
... ...
@@ -11,20 +11,20 @@ TESTDATA_REPO = "https://github.com/schokokeksorg/freewvs-testdata"
11 11
 
12 12
 
13 13
 class TestFreewvsData(unittest.TestCase):
14
-    @unittest.skipUnless(os.environ.get("FREEWVS_ONLINETESTS"),
14
+    @unittest.skipUnless(os.environ.get("RUN_ONLINETESTS"),
15 15
                          "Not running online tests")
16 16
     def test_freewvs_testdata(self):
17
-        tmp = tempfile.mkdtemp(prefix="freewvs-testdata")
18
-        if os.environ.get("FREEWVS_TESTDATA_REPOSITORY"):
19
-            os.symlink(os.environ.get("FREEWVS_TESTDATA_REPOSITORY"),
20
-                       tmp + "/freewvs-testdata")
17
+        tmp = tempfile.mkdtemp(prefix="testdata")
18
+        if os.environ.get("TESTDATA_REPOSITORY"):
19
+            os.symlink(os.environ.get("TESTDATA_REPOSITORY"),
20
+                       tmp + "/testdata")
21 21
         else:
22 22
             subprocess.run(["git", "clone", "--depth=1",
23 23
                             TESTDATA_REPO,
24
-                            tmp + "/freewvs-testdata"],
24
+                            tmp + "/testdata"],
25 25
                            check=True)
26 26
 
27
-        for tdir in glob.glob(tmp + "/freewvs-testdata/webapps/*"):
27
+        for tdir in glob.glob(tmp + "/testdata/webapps/*"):
28 28
             bdir = os.path.basename(tdir)
29 29
             for tarball in glob.glob(tdir + "/dist/*"):
30 30
                 shutil.unpack_archive(tarball, "%s/%s/%s-src"
Browse code

use assertEqual to make pylint happy

Hanno Böck authored on22/12/2019 12:35:29
Showing1 changed files
... ...
@@ -41,7 +41,8 @@ class TestFreewvsData(unittest.TestCase):
41 41
             refclean = sorted(refclean.split("\n"))
42 42
             if refclean != fwclean:
43 43
                 print("\n".join(difflib.ndiff(refclean, fwclean)))
44
-                raise Exception("Output in %s does not match" % bdir)
44
+            self.assertEqual(refclean, fwclean,
45
+                             msg="Output in %s does not match" % bdir)
45 46
 
46 47
 
47 48
 if __name__ == '__main__':
Browse code

avoid some pylint warnings

Hanno Böck authored on14/12/2019 09:46:03
Showing1 changed files
... ...
@@ -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)
Browse code

remove debugging leftover

Hanno Böck authored on13/12/2019 12:51:11
Showing1 changed files
... ...
@@ -15,7 +15,6 @@ class TestFreewvsData(unittest.TestCase):
15 15
                          "Not running online tests")
16 16
     def test_freewvs_testdata(self):
17 17
         tmp = tempfile.mkdtemp(prefix="freewvs-testdata")
18
-        print(tmp)
19 18
         if os.environ.get("FREEWVS_TESTDATA_REPOSITORY"):
20 19
             os.symlink(os.environ.get("FREEWVS_TESTDATA_REPOSITORY"),
21 20
                        tmp + "/freewvs-testdata")
Browse code

add test with online testdata

Hanno Böck authored on13/12/2019 10:46:01
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,49 @@
1
+import unittest
2
+import subprocess
3
+import glob
4
+import os
5
+import tempfile
6
+import shutil
7
+import re
8
+import difflib
9
+
10
+TESTDATA_REPO = "https://github.com/schokokeksorg/freewvs-testdata"
11
+
12
+
13
+class TestFreewvsData(unittest.TestCase):
14
+    @unittest.skipUnless(os.environ.get("FREEWVS_ONLINETESTS"),
15
+                         "Not running online tests")
16
+    def test_freewvs_testdata(self):
17
+        tmp = tempfile.mkdtemp(prefix="freewvs-testdata")
18
+        print(tmp)
19
+        if os.environ.get("FREEWVS_TESTDATA_REPOSITORY"):
20
+            os.symlink(os.environ.get("FREEWVS_TESTDATA_REPOSITORY"),
21
+                       tmp + "/freewvs-testdata")
22
+        else:
23
+            subprocess.run(["git", "clone", "--depth=1",
24
+                            TESTDATA_REPO,
25
+                            tmp + "/freewvs-testdata"],
26
+                           check=True)
27
+
28
+        for dir in glob.glob(tmp + "/freewvs-testdata/webapps/*"):
29
+            bdir = os.path.basename(dir)
30
+            for tarball in glob.glob(dir + "/dist/*"):
31
+                shutil.unpack_archive(tarball, "%s/%s/%s-src"
32
+                                      % (tmp, bdir, os.path.basename(tarball)))
33
+            fwrun = subprocess.run(["./freewvs", "-a", tmp + "/" + bdir],
34
+                                   stdout=subprocess.PIPE, check=True)
35
+            fwdata = re.sub(tmp, "[dir]", fwrun.stdout.decode("utf-8"))
36
+            fwclean = re.sub(r' \(.* ', " ", fwdata)
37
+            f = open(dir + "/refdata-a.txt")
38
+            refdata = f.read()
39
+            f.close()
40
+            refclean = re.sub(r' \(.* ', " ", refdata)
41
+            fwclean = sorted(fwclean.split("\n"))
42
+            refclean = sorted(refclean.split("\n"))
43
+            if refclean != fwclean:
44
+                print("\n".join(difflib.ndiff(refclean, fwclean)))
45
+                raise Exception("Output in %s does not match" % bdir)
46
+
47
+
48
+if __name__ == '__main__':
49
+    unittest.main()