mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 01:06:50 +00:00
atime unit test: hardcode "round" timestamps
just to avoid rounding / precision issues with floating point computations on py < 3.3 I used 2 hardcoded "full second" values on the input file and check if they get restored correctly.
This commit is contained in:
parent
c492011a92
commit
765999195d
1 changed files with 4 additions and 2 deletions
|
@ -288,14 +288,16 @@ def test_basic_functionality(self):
|
|||
|
||||
def test_atime(self):
|
||||
have_root = self.create_test_files()
|
||||
atime, mtime = 123456780, 234567890
|
||||
os.utime('input/file1', (atime, mtime))
|
||||
self.cmd('init', self.repository_location)
|
||||
self.cmd('create', self.repository_location + '::test', 'input')
|
||||
with changedir('output'):
|
||||
self.cmd('extract', self.repository_location + '::test')
|
||||
sti = os.stat('input/file1')
|
||||
sto = os.stat('output/input/file1')
|
||||
assert st_mtime_ns(sti) == st_mtime_ns(sto)
|
||||
assert st_atime_ns(sti) == st_atime_ns(sto)
|
||||
assert st_mtime_ns(sti) == st_mtime_ns(sto) == mtime * 1e9
|
||||
assert st_atime_ns(sti) == st_atime_ns(sto) == atime * 1e9
|
||||
|
||||
def _extract_repository_id(self, path):
|
||||
return Repository(self.repository_path).id
|
||||
|
|
Loading…
Reference in a new issue