Create a test file with specific content and optional modification time.
(
self, path: Path, content: str, modtime: Optional[float] = None
)
| 50 | shutil.rmtree(self.test_dir, ignore_errors=True) |
| 51 | |
| 52 | def create_test_file( |
| 53 | self, path: Path, content: str, modtime: Optional[float] = None |
| 54 | ) -> Path: |
| 55 | """Create a test file with specific content and optional modification time.""" |
| 56 | with open(path, "w") as f: |
| 57 | f.write(content) |
| 58 | |
| 59 | if modtime: |
| 60 | # Set specific modification time |
| 61 | os.utime(path, (modtime, modtime)) |
| 62 | |
| 63 | return path |
| 64 | |
| 65 | def touch_file(self, path: Path) -> float: |
| 66 | """Touch a file to update its modification time without changing content.""" |
no test coverage detected