]> git.ipfire.org Git - pakfire.git/commitdiff
tests: Migrate other Python tests to the new framework
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 25 Jan 2024 16:04:44 +0000 (16:04 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 25 Jan 2024 16:04:44 +0000 (16:04 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/python/jail.py
tests/python/package.py

index 7c0f64171f065310ffb4d843541774d608546d87..265f7e66a3451f9e96ed1c85fcf93db9183198b9 100755 (executable)
@@ -1,20 +1,16 @@
 #!/usr/bin/python3
 
 import logging
-import os
 import pakfire
-import unittest
 
-class JailTests(unittest.TestCase):
+import tests
+
+class JailTests(tests.TestCase):
        """
                This tests the execute command
        """
        def setUp(self):
-               path = os.environ.get("TEST_STUB_ROOT")
-               if not path:
-                       raise RuntimeError("TEST_STUB_ROOT is not defined")
-
-               self.pakfire = pakfire.Pakfire(path)
+               self.pakfire = self.setup_pakfire()
 
        def test_execute(self):
                r = self.pakfire.execute(["/command", "exit-with-code", "0"])
@@ -150,4 +146,4 @@ class JailTests(unittest.TestCase):
 
 
 if __name__ == "__main__":
-       unittest.main()
+       tests.main()
index 0aa2a585ac1d6c953fb86aaa79b4452abf0da45b..3b51b6744fe044e164e0085382fe3b7e1fa8a040 100755 (executable)
@@ -1,19 +1,15 @@
 #!/usr/bin/python3
 
 import os
-import pakfire
-import unittest
 
-class Test(unittest.TestCase):
+import tests
+
+class PackageTest(tests.TestCase):
        """
                This tests the Package class
        """
        def setUp(self):
-               path = os.environ.get("TEST_STUB_ROOT")
-               if not path:
-                       raise RuntimeError("TEST_STUB_ROOT is not defined")
-
-               self.pakfire = pakfire.Pakfire(path)
+               self.pakfire = self.setup_pakfire()
 
        def test_open(self):
                path = os.path.join(
@@ -94,4 +90,4 @@ class Test(unittest.TestCase):
 
 
 if __name__ == "__main__":
-       unittest.main()
+       tests.main()