def hide_err_only_hides_stderr(self): run("echo 'foo' && echo 'bar' 1>&2", hide='err') eq_(sys.stdout.getvalue().strip(), "foo") eq_(sys.stderr.getvalue().strip(), "")
def hide_None_hides_nothing(self): run("echo 'foo' && echo 'bar' 1>&2", hide=None) eq_(sys.stdout.getvalue().strip(), "foo") eq_(sys.stderr.getvalue().strip(), "bar")
def hide_kwarg_allows_hiding_output(self): run("echo 'foo'", hide='both') eq_(sys.stdall.getvalue(), "")
def hide_out_only_hides_stdout(self): run("echo 'foo' && echo 'bar' 1>&2", hide='out') eq_(sys.stdout.getvalue().strip(), "") eq_(sys.stderr.getvalue().strip(), "bar")
def non_one_return_codes_still_act_as_False(self): ok_(not run("goobypls", warn=True, hide='both'))
def warn_kwarg_allows_continuing_past_failures(self): eq_(run("false", warn=True).exited, 1)
def fast_failures(self): run("false")
def implicit_task_module(self): # Contains tasks.py os.chdir('implicit') # Doesn't specify --collection result = run("invoke foo") eq_(result.stdout, "Hm\n")
def return_code_in_result(self): r = run("echo 'foo'", hide='both') eq_(r.stdout, "foo\n") eq_(r.return_code, 0) eq_(r.exited, 0)
def nonzero_return_code_for_failures(self): result = run("false", warn=True) eq_(result.exited, 1) result = run("goobypls", warn=True, hide='both') eq_(result.exited, 127)
def fail(): run("false")
def command_failure(self): "Command failure doesn't show tracebacks" result = run("inv -c fail fail", warn=True) sentinel = 'Traceback (most recent call last)' assert sentinel not in result.stderr assert result.exited != 0
def invocation_with_args(self): result = run("invoke -c integration print_name --name whatevs") eq_(result.stdout, "whatevs\n")
def hide_unknown_vals_raises_ValueError(self): run("command", hide="what")
def run_acts_as_success_boolean(self): ok_(not run("false", warn=True)) ok_(run("true"))
def test(module=None): run("spec" + ((" --tests=tests/%s.py" % module) if module else ""))
def setup(self): os.chdir(support) sys.stdout, self.orig_stdout = StringIO.StringIO(), sys.stdout sys.stderr, self.orig_stderr = StringIO.StringIO(), sys.stderr self.result = run("invoke -c integration print_foo")