Exemplo n.º 1
0
 def impl_run_program(self, command_line, join_stderr_stdout=True):
     options = command_line[1:]
     stdout = StringIO()
     if join_stderr_stdout:
         stderr = stdout
     else:
         stderr = StringIO()
     with log.swap_streams(stdout=stdout, stderr=stderr):
         try:
             returncode = main(options)
         except SystemExit as err:
             returncode = err.code
     output = stdout.getvalue()
     error = stderr.getvalue()
     return returncode, output, error
Exemplo n.º 2
0
 def impl_help(self, help_item):
     stream = StringIO()
     help_function = getattr(help_functions, 'help_{}'.format(help_item))
     help_function(test=True,
                   interactive=False,
                   writer=lambda x: stream.write(x))
     self.assertGreater(len(stream.getvalue()), 0)