]> git.ipfire.org Git - pakfire.git/commitdiff
tests: execute: Check that we are not running for forever
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 25 Mar 2025 10:42:39 +0000 (10:42 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 25 Mar 2025 10:42:39 +0000 (10:42 +0000)
There was a bug once where the loop never terminated if the process
actually could never be executed.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/python/execute.py

index 97bf4b501af276ac6334d951c5794cc88fcf0d46..b8b4bcd5ecd432ecfc7c19b40bd7d2830ea54096 100755 (executable)
@@ -118,6 +118,10 @@ class ExecuteTests(tests.TestCase):
                # Test a very long string
                test(b"A" * 8192 + b"\n")
 
+               # Ensure that we won't run forever in case the command cannot be found
+               with self.assertRaises(pakfire.CommandExecutionError):
+                       self.pakfire.execute(["/does-not-exist"], input=b"1234")
+
        def test_nice(self):
                self.pakfire.execute(["/command", "print-nice"], nice=5)