import pickle


def venv_fixture(pickle_file):
    """Loads required virtualenv pkg data from a pickle file

    :param pickle_file: path to a .pickle file
    :returns: a tuple of pkgs, pkg_index, req_map
    :rtype: tuple

    """
    with open(pickle_file, 'rb') as f:
        pkgs = pickle.load(f)
        pkg_index = dict((p.key, p) for p in pkgs)
        req_map = dict((p, p.requires()) for p in pkgs)
        return pkgs, pkg_index, req_map