def setUp(self):
# Enable this to turn on debugging output
# tout.init(tout.DEBUG)
- command.test_result = None
+ command.TEST_RESULT = None
def tearDown(self):
"""Remove the temporary output directory"""
def testFullHelpInternal(self):
"""Test that the full help is displayed with -H"""
try:
- command.test_result = command.CommandResult()
+ command.TEST_RESULT = command.CommandResult()
result = self._DoBinman('-H')
help_file = os.path.join(self._binman_dir, 'README.rst')
finally:
- command.test_result = None
+ command.TEST_RESULT = None
def testHelp(self):
"""Test that the basic help is displayed with -h"""
def testGbb(self):
"""Test for the Chromium OS Google Binary Block"""
- command.test_result = self._HandleGbbCommand
+ command.TEST_RESULT = self._HandleGbbCommand
entry_args = {
'keydir': 'devkeys',
'bmpblk': 'bmpblk.bin',
def testVblock(self):
"""Test for the Chromium OS Verified Boot Block"""
self._hash_data = False
- command.test_result = self._HandleVblockCommand
+ command.TEST_RESULT = self._HandleVblockCommand
entry_args = {
'keydir': 'devkeys',
}
def testVblockContent(self):
"""Test that the vblock signs the right data"""
self._hash_data = True
- command.test_result = self._HandleVblockCommand
+ command.TEST_RESULT = self._HandleVblockCommand
entry_args = {
'keydir': 'devkeys',
}
def testFitSubentryUsesBintool(self):
"""Test that binman FIT subentries can use bintools"""
- command.test_result = self._HandleGbbCommand
+ command.TEST_RESULT = self._HandleGbbCommand
entry_args = {
'keydir': 'devkeys',
'bmpblk': 'bmpblk.bin',
self._git_dir = os.path.join(self._base_dir, 'src')
self._buildman_pathname = sys.argv[0]
self._buildman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
- command.test_result = self._HandleCommand
+ command.TEST_RESULT = self._HandleCommand
bsettings.setup(None)
bsettings.add_file(settings_data)
self.setupToolchains()
return result
def testFullHelp(self):
- command.test_result = None
+ command.TEST_RESULT = None
result = self._RunBuildman('-H')
help_file = os.path.join(self._buildman_dir, 'README.rst')
# Remove possible extraneous strings
self.assertEqual(0, result.return_code)
def testHelp(self):
- command.test_result = None
+ command.TEST_RESULT = None
result = self._RunBuildman('-h')
help_file = os.path.join(self._buildman_dir, 'README.rst')
self.assertTrue(len(result.stdout) > 1000)
def testGitSetup(self):
"""Test gitutils.Setup(), from outside the module itself"""
- command.test_result = command.CommandResult(return_code=1)
+ command.TEST_RESULT = command.CommandResult(return_code=1)
gitutil.setup()
self.assertEqual(gitutil.use_no_decorate, False)
- command.test_result = command.CommandResult(return_code=0)
+ command.TEST_RESULT = command.CommandResult(return_code=0)
gitutil.setup()
self.assertEqual(gitutil.use_no_decorate, True)
from u_boot_pylib import cros_subprocess
+# This permits interception of RunPipe for test purposes. If it is set to
+# a function, then that function is called with the pipe list being
+# executed. Otherwise, it is assumed to be a CommandResult object, and is
+# returned as the result for every run_pipe() call.
+# When this value is None, commands are executed as normal.
+TEST_RESULT = None
+
"""Shell command ease-ups for Python."""
class CommandResult:
self.combined = self.combined.decode('utf-8')
return self
-
-# This permits interception of RunPipe for test purposes. If it is set to
-# a function, then that function is called with the pipe list being
-# executed. Otherwise, it is assumed to be a CommandResult object, and is
-# returned as the result for every run_pipe() call.
-# When this value is None, commands are executed as normal.
-test_result = None
-
def run_pipe(pipe_list, infile=None, outfile=None,
capture=False, capture_stderr=False, oneline=False,
raise_on_error=True, cwd=None, binary=False,
Returns:
CommandResult object
"""
- if test_result:
- if hasattr(test_result, '__call__'):
+ if TEST_RESULT:
+ if hasattr(TEST_RESULT, '__call__'):
# pylint: disable=E1102
- result = test_result(pipe_list=pipe_list)
+ result = TEST_RESULT(pipe_list=pipe_list)
if result:
return result
else:
- return test_result
+ return TEST_RESULT
# No result: fall through to normal processing
result = CommandResult(b'', b'', b'')
last_pipe = None