From c2069d473d2a158d25f385a84448e4476dbc9a13 Mon Sep 17 00:00:00 2001 From: Stephen Shen Date: Sat, 24 Jan 2026 22:23:03 -0500 Subject: [PATCH] explicitly close file --- tests/test_core.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index 4b87573..73a0d59 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -262,11 +262,12 @@ def test_resolver(self): schemas_path = "file://" + os.path.join(dirname, "schemas/") resolver = RefResolver(schemas_path, None) - country_schema_file = open(os.path.join(dirname, "schemas/") + "country.json") - person_schema_file = open(os.path.join(dirname, "schemas/") + "person.json") + with open(os.path.join(dirname, "schemas/") + "country.json") as f: + country_schema = json.load(f) + + with open(os.path.join(dirname, "schemas/") + "person.json") as f: + person_schema = json.load(f) - country_schema = json.load(country_schema_file) - person_schema = json.load(person_schema_file) Country = warlock.model_factory(country_schema, resolver=resolver) Person = warlock.model_factory(person_schema, resolver=resolver)