pywin32 icon indicating copy to clipboard operation
pywin32 copied to clipboard

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

Open Avasam opened this issue 1 year ago • 1 comments

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 avatar Mar 14 '24 16:03 Avasam

Again: https://github.com/mhammond/pywin32/actions/runs/9263780117/job/25482794358?pr=2094#step:6:288 file creation is 1.7s over

Avasam avatar May 28 '24 05:05 Avasam

Again: https://github.com/mhammond/pywin32/actions/runs/10116294563/job/27978858210?pr=2326 file creation is 1.11s over

and: https://github.com/mhammond/pywin32/actions/runs/10136104108/job/28024444189?pr=2345#step:6:304 file creation is 3ms under

Avasam avatar Jul 27 '24 00:07 Avasam

Even though it's a lot more rare, it can still happen: https://github.com/mhammond/pywin32/actions/runs/12849779158/job/35828725041?pr=2449#step:8:307

======================================================================
FAIL: testFileTimes (test_win32file.TestSimpleOps.testFileTimes)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\pywin32\pywin32\win32\test\test_win32file.py", line 237, in testFileTimes
    self.assertGreaterEqual(
    ~~~~~~~~~~~~~~~~~~~~~~~^
        ct,
        ^^^
        now,
        ^^^^
        f"File was created in the past - now={now}, created={ct}",
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
AssertionError: pywintypes.datetime(2025, 1, 19, 3, 12, 3, tzinfo=TimeZoneInfo('GMT Standard Time', True)) not greater than or equal to datetime.datetime(2025, 1, 19, 3, 12, 4, tzinfo=TimeZoneInfo('GMT Standard Time', True)) : File was created in the past - now=2025-01-19 03:12:04+00:00, created=2025-01-19 03:12:03+00:00

Avasam avatar Jan 19 '25 22:01 Avasam

https://github.com/mhammond/pywin32/actions/runs/13646532632/job/38146379612?pr=2459#step:8:307

FAIL: testFileTimes (test_win32file.TestSimpleOps.testFileTimes)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\pywin32\pywin32\win32\test\test_win32file.py", line 237, in testFileTimes
    self.assertGreaterEqual(
    ~~~~~~~~~~~~~~~~~~~~~~~^
        ct,
        ^^^
        now,
        ^^^^
        f"File was created in the past - now={now}, created={ct}",
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
AssertionError: pywintypes.datetime(2025, 3, 4, 5, 5, 28, tzinfo=TimeZoneInfo('GMT Standard Time', True)) not greater than or equal to datetime.datetime(2025, 3, 4, 5, 5, 29, tzinfo=TimeZoneInfo('GMT Standard Time', True)) : File was created in the past - now=2025-03-04 05:05:29+00:00, created=2025-03-04 05:05:28+00:00

Avasam avatar Mar 04 '25 16:03 Avasam