# HG changeset patch # User domruf # Date 2017-03-26 15:27:16 # Node ID 36f09fa6446ddd0864f7a9fabecd915406bf0420 # Parent 3c720eeaca89c44dd6c231b6bfba71d4d29b4685 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. diff --git a/kallithea/tests/vcs/test_archives.py b/kallithea/tests/vcs/test_archives.py --- a/kallithea/tests/vcs/test_archives.py +++ b/kallithea/tests/vcs/test_archives.py @@ -80,7 +80,13 @@ class ArchivesTestCaseMixin(_BackendTest 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):