def test_run_backend_keyboard_interrupt(self, mc_be, mc_daemon_context, capsys): mc_be.return_value.run.side_effect = KeyboardInterrupt() with pytest.raises(KeyboardInterrupt): run_backend(self.run_opts) stdout, stderr = capsys.readouterr() assert "Killing/Dying" in stderr
def test_run_backend_basic(self, mc_be, mc_daemon_context): self.grp.getgrnam.return_value.gr_gid = 7 self.pwd.getpwnam.return_value.pw_uid = 9 run_backend(self.run_opts) ddc = mc_daemon_context.call_args[1] assert ddc["signal_map"] == {1: u'terminate', 15: u'terminate'} assert ddc["umask"] == 0o22 assert ddc["gid"] == 7 assert ddc["uid"] == 9 assert ddc["stderr"] == sys.stderr assert mc_be.called expected_call = mock.call(self.config_file, ext_opts=self.run_opts) assert mc_be.call_args == expected_call
def main(args): opts = parse_args(args) run_backend(opts)