import pathlib


def tmp_cache(config, tmpdir):
    """Move the cache to a temporary dir that is empty at the start of the test and
    deleted after the test."""
    config['CACHE_ROOT_DIR'] = pathlib.Path(tmpdir)
    return config['CACHE_ROOT_DIR']