--- a/tests/test-filecache.py Mon Mar 05 15:07:32 2018 -0500
+++ b/tests/test-filecache.py Mon Mar 05 12:30:20 2018 -0500
@@ -1,5 +1,6 @@
from __future__ import absolute_import, print_function
import os
+import stat
import subprocess
import sys
@@ -200,7 +201,7 @@
fp.close()
oldstat = os.stat(filename)
- if oldstat.st_ctime != oldstat.st_mtime:
+ if oldstat[stat.ST_CTIME] != oldstat[stat.ST_MTIME]:
# subsequent changing never causes ambiguity
continue
@@ -219,16 +220,17 @@
fp.write('BAR')
newstat = os.stat(filename)
- if oldstat.st_ctime != newstat.st_ctime:
+ if oldstat[stat.ST_CTIME] != newstat[stat.ST_CTIME]:
# timestamp ambiguity was naturally avoided while repetition
continue
# st_mtime should be advanced "repetition * 2" times, because
# all changes occurred at same time (in sec)
- expected = (oldstat.st_mtime + repetition * 2) & 0x7fffffff
- if newstat.st_mtime != expected:
- print("'newstat.st_mtime %s is not %s (as %s + %s * 2)" %
- (newstat.st_mtime, expected, oldstat.st_mtime, repetition))
+ expected = (oldstat[stat.ST_MTIME] + repetition * 2) & 0x7fffffff
+ if newstat[stat.ST_MTIME] != expected:
+ print("'newstat[stat.ST_MTIME] %s is not %s (as %s + %s * 2)" %
+ (newstat[stat.ST_MTIME], expected,
+ oldstat[stat.ST_MTIME], repetition))
# no more examination is needed regardless of result
break