def inner(compare_fct, data, tag=None): dir_name, file_name = test_name file_name += tag or '' cache_dir = str(request.config.cache.makedir(dir_name)) file_name_full = os.path.join(cache_dir, file_name) try: val = load(file_name_full) except OSError: save(data, file_name_full) raise ValueError('Reference data does not exist.') else: assert compare_fct(val, data)
def inner(compare_fct, data, tag=None): dir_name, file_name = test_name file_name += tag or "" cache_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "regression_data", dir_name) os.makedirs(cache_dir, exist_ok=True) file_name_full = os.path.join(cache_dir, file_name) try: val = load(file_name_full) except OSError as exc: save(data, file_name_full) raise ValueError("Reference data does not exist.") from exc else: assert compare_fct(val, data)