def mock_command_line(self, args): """Run `args` through the command line, with a Mock. Returns the Mock it used and the status code returned. """ m = self.model_object() ret = coverage.CoverageScript(_covpkg=m, _run_python_file=m.run_python_file, _help_fn=m.help_fn).command_line( shlex.split(args)) return m, ret
def command_line(self, args, ret=OK, _covpkg=None): """Run `args` through the command line. Use this when you want to run the full coverage machinery, but in the current process. Exceptions may be thrown from deep in the code. Asserts that `ret` is returned by `CoverageScript.command_line`. Compare with `run_command`. Returns None. """ script = coverage.CoverageScript(_covpkg=_covpkg) ret_actual = script.command_line(shlex.split(args)) self.assertEqual(ret_actual, ret)