def METHOD_NAME(mock_packages):
    # Assumes at least two packages -- mpich and mpich2 -- have tags
    mock_index = spack.repo.PATH.tag_index
    assert mock_index.tags
    ostream = io.StringIO()
    mock_index.to_json(ostream)
    istream = io.StringIO(ostream.getvalue())
    new_index = spack.tag.TagIndex.from_json(istream, repository=mock_packages)
    assert mock_index == new_index