Example #1
0
    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)])
Example #2
0
    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)])