def test_agent_not_found(self):
        """
        If there is not a running ssh-agent, ``ssh_agent_has_ssh_key`` returns
        a deferred that fails with ``AgentNotFound``.
        """
        try:
            old_agent_socket = os.environ['SSH_AUTH_SOCK']
            self.addCleanup(os.environ.__setitem__,
                            'SSH_AUTH_SOCK', old_agent_socket)
            del os.environ['SSH_AUTH_SOCK']
        except __HOLE__:
            # SSH_AUTH_SOCK wasn't set, so no need to restore it.
            pass

        key_file = FilePath(self.mktemp())
        key = generate_ssh_key(key_file)
        return self.assertFailure(
            ensure_agent_has_ssh_key(self.reactor, key),
            AgentNotFound)
dataset/ETHPy150Open ClusterHQ/flocker/flocker/provision/test/test_ssh_keys.py/EnsureKeyTests.test_agent_not_found