From c04891cbe054fc734e8ce55ea64860fc4cfd7c0f Mon Sep 17 00:00:00 2001 From: Nicolas Galler Date: Tue, 13 Oct 2020 13:09:27 +0000 Subject: [PATCH] [FIX] base: correct unit test for compatibility with PIL 7.0 The unit test in `test_base_document_layout` does not pass with version 7.0.0 of PIL, which is loaded by default on Ubuntu 20.04. The reason is that the color obtained from the image is slightly different. This fix slightly relaxes the test (in fact we don't care about the exact color obtained in this test, we just want to make sure that it doesn't crash) opw-2342394 (original ticket) closes odoo/odoo#60071 X-original-commit: 99b3f0be1b322ee469871f9496527e8dc3e778bb Signed-off-by: Thomas Dieuzeide Signed-off-by: Nicolas Galler --- addons/web/tests/test_base_document_layout.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/tests/test_base_document_layout.py b/addons/web/tests/test_base_document_layout.py index dd8f4e2ad24..0f3f9e8b1dc 100644 --- a/addons/web/tests/test_base_document_layout.py +++ b/addons/web/tests/test_base_document_layout.py @@ -195,7 +195,7 @@ class TestBaseDocumentLayout(TestBaseDocumentLayoutHelpers): self.assertColors(doc_layout, self.company_imgs['sweden']['colors']) def test_parse_company_colors_grayscale(self): - """Grayscale images with transparency""" + """Grayscale images with transparency - make sure the color extraction does not crash""" self.company.write({ 'primary_color': '#ff0080', 'secondary_color': '#00ff00', @@ -205,7 +205,7 @@ class TestBaseDocumentLayout(TestBaseDocumentLayoutHelpers): with Image.open(os.path.join(dir_path, 'logo_ci.png'), 'r') as img: base64_img = image_to_base64(img, 'PNG') doc_layout.logo = base64_img - self.assertEqual('#8d8d8d', doc_layout.primary_color) + self.assertNotEqual(None, doc_layout.primary_color) # /!\ This case is NOT supported, and probably not supportable