changeset 6547:36f09fa6446d

tests: don't compare MTIME header of gzip file The gzip header contains a MTIME part (Modification TIME). http://www.zlib.org/rfc-gzip.html Because is takes a little bit of time, from one fill_archive call to the next, this part may differ and fail the test from time to time. So we should not include that part in the comparison.
author domruf <dominikruf@gmail.com>
date Sun, 26 Mar 2017 15:27:16 +0200
parents 3c720eeaca89
children 28f631e2c757
files kallithea/tests/vcs/test_archives.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/vcs/test_archives.py	Fri Feb 10 23:02:57 2017 +0100
+++ b/kallithea/tests/vcs/test_archives.py	Sun Mar 26 15:27:16 2017 +0200
@@ -80,7 +80,13 @@
         self.tip.fill_archive(stream=mystream)
         mystream.seek(0)
         with open(tmppath, 'rb') as f:
-            self.assertEqual(f.read(), mystream.read())
+            file_content = f.read()
+            stringio_content = mystream.read()
+            # the gzip header contains a MTIME header
+            # because is takes a little bit of time from one fill_archive call to the next
+            # this part may differ so don't include that part in the comparison
+            self.assertEqual(file_content[:4], stringio_content[:4])
+            self.assertEqual(file_content[8:], stringio_content[8:])
 
     def test_archive_wrong_kind(self):
         with self.assertRaises(VCSError):