def test_run_simple(self): self.setupStep( shell.ShellCommandNewStyle(workdir='build', command="echo hello")) self.expectCommands( ExpectShell(workdir='build', command='echo hello') + 0) self.expectOutcome(result=SUCCESS, state_string="'echo hello'") return self.runStep()
def test_constructor_args_validity(self): # this checks that an exception is raised for invalid arguments with self.assertRaisesConfigError( "Invalid argument(s) passed to ShellCommandNewStyle: "): shell.ShellCommandNewStyle(workdir='build', command="echo Hello World", wrongArg1=1, wrongArg2='two')
def test_run_usePTY_old_worker(self): self.setupStep(shell.ShellCommandNewStyle(workdir='build', command="echo hello", usePTY=True), worker_version=dict(shell='1.1')) self.expectCommands( ExpectShell(workdir='build', command='echo hello') + 0) self.expectOutcome(result=SUCCESS) return self.runStep()
def test_run_nested_command(self): self.setupStep( shell.ShellCommandNewStyle( workdir='build', command=['trial', ['-b', '-B'], 'buildbot.test'])) self.expectCommands( ExpectShell(workdir='build', command=['trial', '-b', '-B', 'buildbot.test']) + 0) self.expectOutcome(result=SUCCESS, state_string="'trial -b ...'") return self.runStep()
def test_run_usePTY(self): self.setupStep( shell.ShellCommandNewStyle(workdir='build', command="echo hello", usePTY=False)) self.expectCommands( ExpectShell(workdir='build', command='echo hello', usePTY=False) + 0) self.expectOutcome(result=SUCCESS) return self.runStep()
def test_run_env(self): self.setupStep(shell.ShellCommandNewStyle(workdir='build', command="echo hello"), worker_env=dict(DEF='HERE')) self.expectCommands( ExpectShell( workdir='build', command='echo hello', env=dict(DEF='HERE')) + 0) self.expectOutcome(result=SUCCESS) return self.runStep()
def test_run_nested_description(self): self.setupStep( shell.ShellCommandNewStyle( workdir='build', command=properties.FlattenList( ['trial', ['-b', '-B'], 'buildbot.test']), descriptionDone=properties.FlattenList(['test', ['done']]), descriptionSuffix=properties.FlattenList(['suff', ['ix']]))) self.expectCommands( ExpectShell(workdir='build', command=['trial', '-b', '-B', 'buildbot.test']) + 0) self.expectOutcome(result=SUCCESS, state_string='test done suff ix') return self.runStep()
def test_run_decodeRC(self, rc=1, results=WARNINGS, extra_text=" (warnings)"): self.setupStep( shell.ShellCommandNewStyle(workdir='build', command="echo hello", decodeRC={1: WARNINGS})) self.expectCommands( ExpectShell(workdir='build', command='echo hello') + rc) self.expectOutcome(result=results, state_string="'echo hello'" + extra_text) return self.runStep()
def test_doStepIf_False(self): self.setupStep( shell.ShellCommandNewStyle(command="echo hello", doStepIf=False)) self.expectOutcome(result=SKIPPED, state_string="'echo hello' (skipped)") return self.runStep()