From 765999195d95d7f86db1ed519aa8ac8b9d09240f Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 26 Oct 2015 22:34:08 +0100 Subject: [PATCH] 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. --- borg/testsuite/archiver.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/borg/testsuite/archiver.py b/borg/testsuite/archiver.py index d8a91c220..b476c77d3 100644 --- a/borg/testsuite/archiver.py +++ b/borg/testsuite/archiver.py @@ -288,14 +288,16 @@ class ArchiverTestCase(ArchiverTestCaseBase): 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