From b4d6a72ae4db7a5b83415b6fcf632ed04475fb09 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Wed, 13 Feb 2013 16:30:47 -0500 Subject: fixed unit tests --- .../Bcfg2/Server/Plugins/Cfg/CfgExternalCommandVerifier.py | 11 ++++------- .../TestPlugins/TestCfg/TestCfgExternalCommandVerifier.py | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgExternalCommandVerifier.py b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgExternalCommandVerifier.py index 8e2d98db9..313e53ee9 100644 --- a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgExternalCommandVerifier.py +++ b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgExternalCommandVerifier.py @@ -26,13 +26,10 @@ class CfgExternalCommandVerifier(CfgVerifier): out, err = proc.communicate(input=data) rv = proc.wait() if rv != 0: - if not err: - if out: - # got nothing on stderr, try stdout - err = out - else: - err = "Non-zero return value %s" % rv - raise CfgVerificationError(err.strip()) + # pylint: disable=E1103 + raise CfgVerificationError(err.strip() or out.strip() or + "Non-zero return value %s" % rv) + # pylint: enable=E1103 except CfgVerificationError: raise except: diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgExternalCommandVerifier.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgExternalCommandVerifier.py index 11dbdd391..0f369113b 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgExternalCommandVerifier.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgExternalCommandVerifier.py @@ -26,7 +26,7 @@ class TestCfgExternalCommandVerifier(TestCfgVerifier): proc = Mock() mock_Popen.return_value = proc proc.wait.return_value = 0 - proc.communicate.return_value = MagicMock() + proc.communicate.return_value = ("stdout", "stderr") entry = lxml.etree.Element("Path", name="/test.txt") metadata = Mock() -- cgit v1.2.3-1-g7c22