Skip to content

Commit 8503893

Browse files
committed
refactor: Align mock directories in tests
1 parent 994013a commit 8503893

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

tests/test_cached_files.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@
77

88

99
@pytest.fixture(scope="module")
10-
def tmp_path_for_module(tmp_path_factory):
11-
return tmp_path_factory.mktemp("temp")
12-
13-
14-
@pytest.fixture(scope="module")
15-
def mock_directory(tmp_path_for_module):
10+
def mock_directory(tmp_path_factory):
1611
"""Create a temporary directory, populate with files and folders."""
17-
tmp_path = tmp_path_for_module
12+
tmp_path = tmp_path_factory.mktemp("temp")
1813
(tmp_path / "file1.txt").write_text("This is a text file.")
1914
(tmp_path / "file2.log").write_text("Log content here.")
2015
subdir = tmp_path / "subdir"

tests/test_list_directory.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88

99
@pytest.fixture
1010
def mock_directory(tmp_path: Path):
11-
"""Create a mock directory with various files and subdirectories for testing."""
12-
# For debugging, set: tmp_path = Path("temp_test"); tmp_path.mkdir()
11+
"""Create a temporary directory, populate with files and folders."""
1312
(tmp_path / "file1.txt").write_text("This is a text file.")
1413
(tmp_path / "file2.log").write_text("Log content here.")
1514
(tmp_path / ".hiddenfile").write_text("Secret content.")
16-
17-
subdir = tmp_path / "subdir"
18-
subdir.mkdir()
19-
(subdir / "file3.txt").write_text("Another text file in a subdirectory.")
20-
2115
hidden_dir = tmp_path / ".hiddendir"
2216
hidden_dir.mkdir()
2317
(hidden_dir / "hidden_file.txt").write_text("Hidden file in hidden dir.")
24-
18+
subdir = tmp_path / "subdir"
19+
subdir.mkdir()
20+
(subdir / "file3.txt").write_text("A Text file in a subdirectory.")
21+
nested_subdir = tmp_path / "nested" / "subdir"
22+
nested_subdir.mkdir(parents=True, exist_ok=True)
23+
(nested_subdir / "file4.txt").write_text("File in the nested directory.")
24+
(nested_subdir / "file5.log").write_text("Another nested directory file.")
2525
return tmp_path
2626

2727

0 commit comments

Comments
 (0)