From 1fb48fbb0b92fb8fc812257cac58359fca19706a Mon Sep 17 00:00:00 2001 From: Heran Yang Date: Fri, 24 May 2024 09:54:38 +0800 Subject: [PATCH] Fix versions.json not exist error --- generate_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/generate_test.py b/generate_test.py index 73345c090..9645f0770 100755 --- a/generate_test.py +++ b/generate_test.py @@ -20,8 +20,10 @@ def test_generate_all(self): tomls = sorted(tomls, key=lambda x: x.parent.name) cache_path = Path(getenv('VERSIONS_CACHE_PATH')) - with open(cache_path, 'r') as cache_file: - versions = json.load(cache_file) if cache_path.exists() else dict() + versions = dict() + if cache_path.exists(): + with open(cache_path, 'r') as cache_file: + versions = json.load(cache_file) for toml in tomls: problem = Problem(Path.cwd(), toml.parent)