From 299e3e5f4cc55dae7123e610dc068806f2b9002b Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 24 Apr 2024 14:53:30 +0200 Subject: [PATCH] index: handle image processing diffs across various Python versions Apparently, the newest Python thingies strip the PNGs a tiny bit smaller, so a fixed file size will lead to the test failing: https://gitlab.com/fdroid/fdroidserver/-/jobs/6703386074 ``` Traceback (most recent call last): File "/builds/fdroid/fdroidserver/tests/index.TestCase", line 704, in test_package_metadata self.assertEqual(36027, metadata['featureGraphic']['en-US']['size']) AssertionError: 36027 != 35619 ``` --- tests/index.TestCase | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/index.TestCase b/tests/index.TestCase index 2f137608..633c0e5f 100755 --- a/tests/index.TestCase +++ b/tests/index.TestCase @@ -701,8 +701,14 @@ class IndexTest(unittest.TestCase): app = apps[appid] metadata = index.package_metadata(app, 'repo') # files - self.assertEqual(36027, metadata['featureGraphic']['en-US']['size']) - self.assertEqual(1413, metadata['icon']['en-US']['size']) + self.assertEqual( + os.path.getsize(f'repo/{appid}/en-US/featureGraphic.png'), + metadata['featureGraphic']['en-US']['size'], + ) + self.assertEqual( + os.path.getsize(f'repo/{appid}/en-US/icon.png'), + metadata['icon']['en-US']['size'], + ) # localized strings self.assertEqual({'en-US': 'title'}, metadata['name']) self.assertEqual({'en-US': 'video'}, metadata['video'])