(pth: Path, fixtures)
| 184 | |
| 185 | |
| 186 | def create_similar_file(pth: Path, fixtures): |
| 187 | struct = [] |
| 188 | |
| 189 | filename = "misc.py" |
| 190 | file_pth = Path(fixtures.path(filename)) |
| 191 | assert os.path.exists(file_pth) |
| 192 | with file_pth.open("r") as fd: |
| 193 | file_content = fd.readlines() |
| 194 | del file_pth |
| 195 | |
| 196 | dest1 = pth / "similar_file/file" / filename |
| 197 | dest1.parent.mkdir(parents=True) |
| 198 | with dest1.open("w") as fd: |
| 199 | fd.writelines(file_content) |
| 200 | |
| 201 | dest2 = pth / "similar_file/directory1/subdirectory" / filename |
| 202 | dest2.parent.mkdir(parents=True) |
| 203 | with dest2.open("w") as fd: |
| 204 | fd.writelines(file_content[:5]) |
| 205 | |
| 206 | struct.append(( |
| 207 | ScanLocation(dest1.parent), |
| 208 | ScanLocation(dest2.parent), |
| 209 | { |
| 210 | "operation": "M", |
| 211 | "a_ref": filename, |
| 212 | "b_ref": filename, |
| 213 | "a_mime": "text/x-python", |
| 214 | "b_mime": "text/x-python" |
| 215 | } |
| 216 | )) |
| 217 | return struct |
| 218 | |
| 219 | |
| 220 | def get_directory_content(pth): # TODO: use ScanLocation.list_recursive instead |
nothing calls this directly
no test coverage detected