From f09e2d7cd575934fcb34609597248a722f55e664 Mon Sep 17 00:00:00 2001 From: Bart Schilperoort Date: Fri, 26 Jul 2024 10:04:15 +0200 Subject: [PATCH] Use context manager to ensure file closure --- tests/test_datasets/test_fapar_lai.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_datasets/test_fapar_lai.py b/tests/test_datasets/test_fapar_lai.py index 0ac135b..504f2d4 100644 --- a/tests/test_datasets/test_fapar_lai.py +++ b/tests/test_datasets/test_fapar_lai.py @@ -100,8 +100,8 @@ def ingest_lai(): f = c.submit(ingest_lai) f.result() - ds = xr.open_mfdataset((ingest_dir / "fapar-lai").glob("*.nc")) - assert isinstance(ds, xr.Dataset) + with xr.open_mfdataset((ingest_dir / "fapar-lai").glob("*.nc")) as ds: + assert isinstance(ds, xr.Dataset) def test_load(self): """Test load function."""