From ca9ba729814ab7940da1adea239742bda71df2aa Mon Sep 17 00:00:00 2001 From: Adam-Aghili <149833988+Adam-Aghili@users.noreply.github.com> Date: Mon, 2 Mar 2026 16:22:37 -0500 Subject: [PATCH] chore: clean up files created during testing (#11844) modified test_save_file_component.py to clean up generated test files once tests are done --- .../processing/test_save_file_component.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/backend/tests/unit/components/processing/test_save_file_component.py b/src/backend/tests/unit/components/processing/test_save_file_component.py index 6830152404..bf206a8269 100644 --- a/src/backend/tests/unit/components/processing/test_save_file_component.py +++ b/src/backend/tests/unit/components/processing/test_save_file_component.py @@ -1,3 +1,4 @@ +import contextlib from pathlib import Path from unittest.mock import AsyncMock, MagicMock, patch from uuid import uuid4 @@ -10,6 +11,18 @@ from tests.base import ComponentTestBaseWithoutClient class TestSaveToFileComponent(ComponentTestBaseWithoutClient): + @pytest.fixture(scope="class", autouse=True) + def cleanup_test_files(self): + """Clean up test files after all tests in the class complete.""" + yield + # Clean up test files created during tests + test_files = ["test_data.json", "test_message.txt", "test_output.csv"] + for filename in test_files: + filepath = Path(filename) + if filepath.exists(): + with contextlib.suppress(Exception): + filepath.unlink() + @pytest.fixture def component_class(self): """Return the component class to test."""