File tree Expand file tree Collapse file tree 2 files changed +10
-15
lines changed Expand file tree Collapse file tree 2 files changed +10
-15
lines changed Original file line number Diff line number Diff line change 7
7
8
8
9
9
@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 ):
16
11
"""Create a temporary directory, populate with files and folders."""
17
- tmp_path = tmp_path_for_module
12
+ tmp_path = tmp_path_factory . mktemp ( "temp" )
18
13
(tmp_path / "file1.txt" ).write_text ("This is a text file." )
19
14
(tmp_path / "file2.log" ).write_text ("Log content here." )
20
15
subdir = tmp_path / "subdir"
Original file line number Diff line number Diff line change 8
8
9
9
@pytest .fixture
10
10
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."""
13
12
(tmp_path / "file1.txt" ).write_text ("This is a text file." )
14
13
(tmp_path / "file2.log" ).write_text ("Log content here." )
15
14
(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
-
21
15
hidden_dir = tmp_path / ".hiddendir"
22
16
hidden_dir .mkdir ()
23
17
(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." )
25
25
return tmp_path
26
26
27
27
You can’t perform that action at this time.
0 commit comments