From 1f9f461581f3fb4985b0bf1d1e074b8cff1c8520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Gioachini?= Date: Mon, 8 Sep 2025 10:18:49 -0300 Subject: [PATCH] Fix ResourceWarning for unclosed files in test_cookiecutter_generation.py (#6020) Co-authored-by: MauGx3 <225707+MauGx3@users.noreply.github.com> Co-authored-by: Bruno Alla Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- tests/test_cookiecutter_generation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index 7d273f44a..0fceb4834 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -168,9 +168,9 @@ def check_paths(paths: Iterable[Path]): if is_binary(str(path)): continue - for line in path.open(): - match = RE_OBJ.search(line) - assert match is None, f"cookiecutter variable not replaced in {path}" + content = path.read_text() + match = RE_OBJ.search(content) + assert match is None, f"cookiecutter variable not replaced in {path}" @pytest.mark.parametrize("context_override", SUPPORTED_COMBINATIONS, ids=_fixture_id)