From baf252393f0bab98a2c2bb8d537fb3c2fc77c071 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Thu, 26 Oct 2023 14:03:56 -0400 Subject: [PATCH] Fix filehandle left open --- tests/test_stnode.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/test_stnode.py b/tests/test_stnode.py index 16f8f68f8..58a39d16f 100644 --- a/tests/test_stnode.py +++ b/tests/test_stnode.py @@ -254,17 +254,19 @@ def test_nuke_validation(nuke_env_var, tmp_path): # Read broken files with datamodel object with context: - datamodels.WfiImgPhotomRefModel(broken_save) + dm = datamodels.WfiImgPhotomRefModel(broken_save) + dm.close() with context: - datamodels.WfiImgPhotomRefModel(broken_to_asdf) + dm = datamodels.WfiImgPhotomRefModel(broken_to_asdf) + dm.close() # True to read broken files with rdm.open with context: - with datamodels.open(broken_save): - pass + with datamodels.open(broken_save) as dm: + dm.close() with context: - with datamodels.open(broken_to_asdf): - pass + with datamodels.open(broken_to_asdf) as dm: + dm.close() @pytest.mark.parametrize("nuke_env_strict_var", VALIDATION_CASES, indirect=True)