File tree 1 file changed +15
-1
lines changed
test cases/common/14 configure file
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 3
3
import os
4
4
import sys
5
5
6
+ def permit_osx_workaround (m1 , m2 ):
7
+ import platform
8
+ if platform .system ().lower () != 'darwin' :
9
+ return False
10
+ if m2 % 10000 != 0 :
11
+ return False
12
+ if m1 // 10000 != m2 // 10000 :
13
+ return False
14
+ return True
15
+
6
16
if len (sys .argv ) == 2 :
7
17
assert (os .path .exists (sys .argv [1 ]))
8
18
elif len (sys .argv ) == 3 :
12
22
m2 = os .stat (f2 ).st_mtime_ns
13
23
# Compare only os.stat()
14
24
if m1 != m2 :
15
- raise RuntimeError (f'mtime of { f1 !r} () != mtime of { m1 !r} ()' )
25
+ # Under macOS the lower four digits sometimes get assigned
26
+ # zero, even though shutil.copy2 should preserve metadata.
27
+ # Just have to accept it, I guess.
28
+ if not permit_osx_workaround (m1 , m2 ):
29
+ raise RuntimeError (f'mtime of { f1 !r} ({ m1 !r} ) != mtime of { f2 !r} ({ m2 !r} )' )
16
30
import filecmp
17
31
if not filecmp .cmp (f1 , f2 ):
18
32
raise RuntimeError (f'{ f1 !r} != { f2 !r} ' )
You can’t perform that action at this time.
0 commit comments