sys.exit.called

Here are the examples of the python api sys.exit.called taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: ganeti Source File: cfgupgrade_unittest.py
def _RunUpgrade(path, dry_run, no_verify, ignore_hostname=True,
                downgrade=False, fail=False):
  args = ["--debug", "--force", "--path=%s" % path, "--confdir=%s" % path]

  if ignore_hostname:
    args.append("--ignore-hostname")
  if dry_run:
    args.append("--dry-run")
  if no_verify:
    args.append("--no-verify")
  if downgrade:
    args.append("--downgrade")

  opts, args = ParseOptions(args=args)
  upgrade = CfgUpgrade(opts, args)

  with mock.patch('sys.exit'):
    with mock.patch.object(upgrade, 'SetupLogging'):
      with mock.patch.object(cli, 'ToStderr'):
        upgrade.Run()
    if sys.exit.called:
      raise Error("upgrade failed")