def run_command(path, cmd): 'runs unilint command and captures output' os.chdir(path) sys.stdout = outputs = StringIO() unilint_main(cmd) sys.stdout = sys.__stdout__ return outputs.getvalue()
def test_help(self): cmd = ["unilint", "--help"] sys.stdout = outputs = StringIO() try: unilint_main(cmd) except SystemExit: pass sys.stdout = sys.__stdout__ output = outputs.getvalue() self.assertTrue('usage:' in output, output)