Beispiel #1
0
 def test_returns_execute_result(self):
     self.stub__find_command(lambda x: 1)
     self.assertEqual(1, cli.run_argv(["lmirror", "foo"], "in", "out", "err"))
Beispiel #2
0
 def test_returns_0_when_None_returned_from_execute(self):
     self.stub__find_command(lambda x: None)
     self.assertEqual(0, cli.run_argv(["lmirror", "foo"], "in", "out", "err"))
Beispiel #3
0
 def test_runs_cmd_with_CLI_UI(self):
     self.stub__find_command(self.capture_ui)
     cli.run_argv(["lmirror", "--version", "foo"], "in", "out", "err")
     self.assertEqual(["foo"], self.calls)
     self.assertIsInstance(self.ui, cli.UI)
Beispiel #4
0
 def test_no_cmd_issues_help(self):
     self.stub__find_command(lambda x: 0)
     cli.run_argv(["lmirror", "--version"], "in", "out", "err")
     self.assertEqual(["help"], self.calls)
Beispiel #5
0
 def test_looks_up_cmd_skips_options(self):
     self.stub__find_command(lambda x: 0)
     cli.run_argv(["lmirror", "--version", "foo"], "in", "out", "err")
     self.assertEqual(["foo"], self.calls)
Beispiel #6
0
def main(*args, **kwargs):
    sys.exit(run_argv(sys.argv, sys.stdin, sys.stdout, sys.stderr))