From 2478b31ac36b5c4397016290d81ba0d894f41896 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Mon, 19 Nov 2012 12:52:37 +0100 Subject: Fix error in iutil.execCapture when fatal and non-zero exit Fix the TypeError problem with iutil.execWithCapture() when fatal and process returns a non-zero exit code. --- tests/pyanaconda_test/iutil_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/pyanaconda_test') diff --git a/tests/pyanaconda_test/iutil_test.py b/tests/pyanaconda_test/iutil_test.py index d772255b3..2f143ec9e 100644 --- a/tests/pyanaconda_test/iutil_test.py +++ b/tests/pyanaconda_test/iutil_test.py @@ -1,4 +1,5 @@ import mock +import sys class IutilTest(mock.TestCase): def setUp(self): @@ -24,3 +25,13 @@ class IutilTest(mock.TestCase): iutil.os.makedirs.assert_called_with("/mnt/sysimage/etc") iutil.shutil.copy.assert_called_with("/etc/securetty", "/mnt/sysimage/etc/securetty") + + def testExecCaptureNonZeroFatal (self): + import iutil + try: + argv = ["-c", "import sys; sys.exit(3);"] + iutil.execWithCapture(sys.executable, argv, root=None, fatal=True) + except RuntimeError, ex: + self.assertIn("return code: 3", str(ex)) + else: + self.fail("RuntimeError not raised") -- cgit