From fd13c7562c415ebc33e3a9b0d68b32f3cf14bf48 Mon Sep 17 00:00:00 2001 From: "John T. Wodder II" Date: Mon, 14 Dec 2020 08:50:08 -0500 Subject: [PATCH] Close a file in a test case --- dandi/tests/test_organize.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dandi/tests/test_organize.py b/dandi/tests/test_organize.py index 0af1251ec..d31ed5c6d 100644 --- a/dandi/tests/test_organize.py +++ b/dandi/tests/test_organize.py @@ -63,7 +63,8 @@ def c(): # shortcut # and if we set units and redo -- years should stay unchanged, while other fields change m = yaml_load(path.read()) m["age"]["units"] = "years" - ruamel.yaml.YAML().dump(m, open(path, "w")) + with open(path, "w") as fp: + ruamel.yaml.YAML().dump(m, fp) populate_dataset_yml(str(path), metadata[:1]) assert c() == {