]> git.ipfire.org Git - pakfire.git/commitdiff
tests: python: Load the configuration file
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 Oct 2024 16:28:33 +0000 (16:28 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 Oct 2024 16:28:33 +0000 (16:28 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/python/tests.py

index 49a5d2a45df604b9f8f11d56e293c9431ad5dc5e..83a9de02a4dd360b9a655cf977e291e08c9bafd6 100644 (file)
@@ -48,7 +48,7 @@ class TestCase(unittest.TestCase):
                # Return a new context
                return pakfire.Ctx(path=path, **kwargs)
 
-       def setup_pakfire(self, ctx=None, path=None, **kwargs):
+       def setup_pakfire(self, ctx=None, path=None, config=None, **kwargs):
                """
                        Sets up a new Pakfire environment
                """
@@ -56,10 +56,14 @@ class TestCase(unittest.TestCase):
                if ctx is None:
                        ctx = self.setup_ctx()
 
+               if config is None:
+                       config = os.environ.get("TEST_CONFIG_FILE")
+
                if path is None:
                        path = os.environ.get("TEST_STUB_ROOT")
 
-               return pakfire.Pakfire(ctx=ctx, path=path, **kwargs)
+               with open(config, "r") as f:
+                       return pakfire.Pakfire(ctx=ctx, path=path, conf=f, **kwargs)
 
        def path(self, *args, **kwargs):
                """