def test_init_open_fail(self): self.os.open.side_effect = IOError with mock.patch.object(daemon.sys, "stderr"): with testtools.ExpectedException(SystemExit): daemon.Pidfile("thefile", "python") sys.assert_has_calls([mock.call.stderr.write(mock.ANY), mock.call.exit(1)])
def test_init_open_fail(self): self.os.open.side_effect = IOError with mock.patch.object(daemon.sys, 'stderr'): with testtools.ExpectedException(SystemExit): daemon.Pidfile('thefile', 'python') sys.assert_has_calls( [mock.call.stderr.write(mock.ANY), mock.call.exit(1)])