diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-05-26 16:09:31 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-05-26 16:09:31 +0200 |
commit | 279fa2f8de00327d5bf242a6086d6439fec2c7bc (patch) | |
tree | 740d7cd64fe110b23152be60bd260c75f241c46e /test/metadata.py | |
parent | aff0f1577e24176bb2dec7afc8f05552708e0dc0 (diff) | |
download | pyexiv2-279fa2f8de00327d5bf242a6086d6439fec2c7bc.tar.gz |
Round the timestamps to have the tests pass
on systems that have a better resolution than the second (e.g. windows).
Diffstat (limited to 'test/metadata.py')
-rw-r--r-- | test/metadata.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/metadata.py b/test/metadata.py index 7abcb6e..1b098b1 100644 --- a/test/metadata.py +++ b/test/metadata.py @@ -94,39 +94,39 @@ class TestImageMetadata(unittest.TestCase): def test_write_preserve_timestamps(self): stat = os.stat(self.pathname) - atime = stat.st_atime - mtime = stat.st_mtime + atime = round(stat.st_atime) + mtime = round(stat.st_mtime) metadata = ImageMetadata(self.pathname) metadata.read() metadata.comment = 'Yellow Submarine' time.sleep(1.1) metadata.write(preserve_timestamps=True) stat2 = os.stat(self.pathname) - atime2 = stat2.st_atime - mtime2 = stat2.st_atime + atime2 = round(stat2.st_atime) + mtime2 = round(stat2.st_atime) self.failUnlessEqual(atime2, atime) self.failUnlessEqual(mtime2, mtime) def test_write_dont_preserve_timestamps(self): stat = os.stat(self.pathname) - atime = stat.st_atime - mtime = stat.st_mtime + atime = round(stat.st_atime) + mtime = round(stat.st_mtime) metadata = ImageMetadata(self.pathname) metadata.read() metadata.comment = 'Yellow Submarine' time.sleep(1.1) metadata.write() stat2 = os.stat(self.pathname) - atime2 = stat2.st_atime - mtime2 = stat2.st_atime + atime2 = round(stat2.st_atime) + mtime2 = round(stat2.st_atime) self.failIfEqual(atime2, atime) self.failIfEqual(mtime2, mtime) metadata.comment = 'Yesterday' time.sleep(1.1) metadata.write(preserve_timestamps=True) stat3 = os.stat(self.pathname) - atime3 = stat3.st_atime - mtime3 = stat3.st_atime + atime3 = round(stat3.st_atime) + mtime3 = round(stat3.st_atime) self.failUnlessEqual(atime3, atime2) self.failUnlessEqual(mtime3, mtime2) |