Support modification dates after 2038 in rewritten files (#4903). pytest would crash with: fp.write(struct.pack("<ll", mtime, size)) E struct.error: argument out of range
(pytester: Pytester, offset)
| 1320 | ) |
| 1321 | @pytest.mark.parametrize("offset", [-1, +1]) |
| 1322 | def test_source_mtime_long_long(pytester: Pytester, offset) -> None: |
| 1323 | """Support modification dates after 2038 in rewritten files (#4903). |
| 1324 | |
| 1325 | pytest would crash with: |
| 1326 | |
| 1327 | fp.write(struct.pack("<ll", mtime, size)) |
| 1328 | E struct.error: argument out of range |
| 1329 | """ |
| 1330 | p = pytester.makepyfile( |
| 1331 | """ |
| 1332 | def test(): pass |
| 1333 | """ |
| 1334 | ) |
| 1335 | # use unsigned long timestamp which overflows signed long, |
| 1336 | # which was the cause of the bug |
| 1337 | # +1 offset also tests masking of 0xFFFFFFFF |
| 1338 | timestamp = 2 ** 32 + offset |
| 1339 | os.utime(str(p), (timestamp, timestamp)) |
| 1340 | result = pytester.runpytest() |
| 1341 | assert result.ret == 0 |
| 1342 | |
| 1343 | |
| 1344 | def test_rewrite_infinite_recursion( |
nothing calls this directly
no test coverage detected