From 2f4b32007c228f45d0ac518fb8b0e94855ca9411 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Fri, 21 Aug 2020 17:38:25 -0400 Subject: [PATCH] Close test temporary file before returning, to avoid permission denied error in windows --- tests/conftest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 200f526d..ba0f1e72 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -98,9 +98,10 @@ def temp_file_1024_delete(temp_dir): The temporary file will be deleted after fixture usage. """ - with tempfile.NamedTemporaryFile(dir=temp_dir) as tmp_file: + with tempfile.NamedTemporaryFile(dir=temp_dir, delete=False) as tmp_file: tmp_file.write(b"*" * 1024) tmp_file.flush() + tmp_file.close() yield tmp_file.name