diff options
author | Stef Walter <stefw@gnome.org> | 2012-11-19 12:52:37 +0100 |
---|---|---|
committer | Brian C. Lane <bcl@redhat.com> | 2012-11-20 11:50:11 -0800 |
commit | 2478b31ac36b5c4397016290d81ba0d894f41896 (patch) | |
tree | 199344bfe350b35041438e9204d81b153de427ae /tests/pyanaconda_test | |
parent | f2b9ed9c309a15da5c3d2402f69260c683426ea1 (diff) | |
download | anaconda-2478b31ac36b5c4397016290d81ba0d894f41896.tar.gz anaconda-2478b31ac36b5c4397016290d81ba0d894f41896.tar.xz anaconda-2478b31ac36b5c4397016290d81ba0d894f41896.zip |
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.
Diffstat (limited to 'tests/pyanaconda_test')
-rw-r--r-- | tests/pyanaconda_test/iutil_test.py | 11 |
1 files changed, 11 insertions, 0 deletions
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") |