]> git.ipfire.org Git - pakfire.git/commitdiff
tests: Add tests for dist()
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Mar 2025 16:11:07 +0000 (16:11 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Mar 2025 16:11:07 +0000 (16:11 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
tests/python/dist.py [new file with mode: 0755]

index cedc64802980d6a8ed74b7ddeb45e3f06929dc3e..e484b4f73d7cd3f1dd9939a40d6905ad859ac35e 100644 (file)
@@ -1286,6 +1286,7 @@ dist_check_SCRIPTS = \
        tests/python/arch.py \
        tests/python/archive.py \
        tests/python/ctx.py \
+       tests/python/dist.py \
        tests/python/execute.py \
        tests/python/keys.py \
        tests/python/main.py \
diff --git a/tests/python/dist.py b/tests/python/dist.py
new file mode 100755 (executable)
index 0000000..410a5cd
--- /dev/null
@@ -0,0 +1,51 @@
+#!/usr/bin/python3
+###############################################################################
+#                                                                             #
+# Pakfire - The IPFire package management system                              #
+# Copyright (C) 2024 Pakfire development team                                 #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+import os
+import pakfire
+
+import tests
+
+class DistTests(tests.TestCase):
+       """
+               This tests the dist command
+       """
+       def setUp(self):
+               self.pakfire = self.setup_pakfire()
+
+       def test_dist(self):
+               """
+                       Packages some dummy package
+               """
+               TEST_DATA_DIR = os.environ.get("TEST_DATA_DIR")
+               assert TEST_DATA_DIR
+
+               # Make the path to the makefile
+               makefile = os.path.join(TEST_DATA_DIR, "packages/dummy/dummy.nm")
+
+               # Run dist()
+               archive = self.pakfire.dist(makefile)
+
+               self.assertIsInstance(archive, pakfire.Archive)
+
+
+if __name__ == "__main__":
+       tests.main()