Skip to content

Commit

Permalink
refactor(test_docs)🔧: Refactor temporary directory handling in tests
Browse files Browse the repository at this point in the history
- Replace pytest.tmp_path with tempfile.TemporaryDirectory for creating temporary directories.
- Use Path from pathlib to handle file paths.
  • Loading branch information
ericmjl committed Nov 29, 2024
1 parent f34e12e commit e71b92f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/cli/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e71b92f

Please sign in to comment.