'Should raise error if PID file is locked.'

def test_raises_error_if_pidfile_locked(self):

    set_pidlockfile_scenario(self, 'exist-other-pid-locked')
    instance = self.test_instance
    instance.daemon_context.open.mock_raises = pidlockfile.AlreadyLocked
    pidfile_path = self.scenario['pidfile_path']
    expect_error = runner.DaemonRunnerStartFailureError
    expect_message_content = pidfile_path
    try:
        instance.do_action()
    except expect_error as exc:
        pass
    else:
        raise self.failureException(('Failed    to    raise    ' + expect_error.__name__))
    self.failUnlessIn(exc.message, expect_message_content)
