Compare two files content. Return False if they differ, True is they are the same.
(file1, file2, ignore_line_endings=False)
| 266 | |
| 267 | |
| 268 | def file_cmp(file1, file2, ignore_line_endings=False): |
| 269 | """ |
| 270 | Compare two files content. |
| 271 | Return False if they differ, True is they are the same. |
| 272 | """ |
| 273 | with open(file1, "rb") as f1: |
| 274 | f1c = f1.read() |
| 275 | if ignore_line_endings: |
| 276 | f1c = b"\n".join(f1c.splitlines(False)) |
| 277 | with open(file2, "rb") as f2: |
| 278 | f2c = f2.read() |
| 279 | if ignore_line_endings: |
| 280 | f2c = b"\n".join(f2c.splitlines(False)) |
| 281 | assert f2c == f1c |
| 282 | |
| 283 | |
| 284 | def make_non_readable(location): |