From e71b92fa925ff551b328c9c7be5a2f4e6e7c0f90 Mon Sep 17 00:00:00 2001 From: Eric Ma Date: Fri, 29 Nov 2024 16:38:23 -0500 Subject: [PATCH] =?UTF-8?q?refactor(test=5Fdocs)=F0=9F=94=A7:=20Refactor?= =?UTF-8?q?=20temporary=20directory=20handling=20in=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace pytest.tmp_path with tempfile.TemporaryDirectory for creating temporary directories. - Use Path from pathlib to handle file paths. --- tests/cli/test_docs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/cli/test_docs.py b/tests/cli/test_docs.py index 5679a25f4..5bf466a7c 100644 --- a/tests/cli/test_docs.py +++ b/tests/cli/test_docs.py @@ -18,7 +18,7 @@ ) from pyprojroot import here from unittest.mock import patch - +import tempfile ### Evals system_prompt1 = """You are an expert in documentation management. @@ -244,8 +244,8 @@ def test_markdown_source_file_diataxis(): mock_get.return_value.status_code = 200 mock_get.return_value.text = "Mock diataxis guide content" - with pytest.tmp_path() as tmp_path: - test_file = tmp_path / "test.md" + with tempfile.TemporaryDirectory() as tmp_dir: + test_file = Path(tmp_dir) / "test.md" test_file.write_text(test_content) # Create MarkdownSourceFile instance