mhammond / pywin32

Python for Windows (pywin32) Extensions
4.9k stars 783 forks source link

Random `testFileTimes` test failure in `test_win32file.py` #2203

Open Avasam opened 3 months ago

Avasam commented 3 months ago

This isn't the first time it happens to me, but is very rare. I haven't looked into it yet, but probably related to time precision, or obtaining "current time" twice leading to a few ticks of difference.

https://github.com/mhammond/pywin32/actions/runs/8283474275/job/22666727095?pr=2145#step:6:292

FAIL: testFileTimes (test_win32file.TestSimpleOps)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\pywin32\pywin32\win32\test\test_win32file.py", line 234, in testFileTimes
    self.assertTrue(now <= ct <= nowish, (now, ct))
AssertionError: False is not true : (datetime.datetime(2024, 3, 14, 15, 43, 53, tzinfo=TimeZoneInfo('GMT Standard Time', True)), pywintypes.datetime(2024, 3, 14, 15, 43, 54, 17000, tzinfo=TimeZoneInfo('GMT Standard Time', True)))

This is a different issue than https://github.com/mhammond/pywin32/issues/2080

Avasam commented 1 month ago

Again: https://github.com/mhammond/pywin32/actions/runs/9263780117/job/25482794358?pr=2094#step:6:288