From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2C6B6138350 for ; Fri, 13 Mar 2020 11:07:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 29C62E0921; Fri, 13 Mar 2020 11:07:25 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D5874E0921 for ; Fri, 13 Mar 2020 11:07:24 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 77B3634EF16 for ; Fri, 13 Mar 2020 11:07:23 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id F27979C for ; Fri, 13 Mar 2020 11:07:21 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1584097632.1a6e9c2bb681945380dd62bf5b915370b991247e.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pydot/files/, dev-python/pydot/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/pydot/files/pydot-1.4.1-unittest.patch dev-python/pydot/pydot-1.4.1.ebuild X-VCS-Directories: dev-python/pydot/ dev-python/pydot/files/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 1a6e9c2bb681945380dd62bf5b915370b991247e X-VCS-Branch: master Date: Fri, 13 Mar 2020 11:07:21 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: a8f5c45b-5307-4999-affb-6e2b828fef08 X-Archives-Hash: 792856496fd6ffb43896d55fb11a76ce commit: 1a6e9c2bb681945380dd62bf5b915370b991247e Author: Michał Górny gentoo org> AuthorDate: Fri Mar 13 10:28:05 2020 +0000 Commit: Michał Górny gentoo org> CommitDate: Fri Mar 13 11:07:12 2020 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a6e9c2b dev-python/pydot: Fix failing tests Closes: https://bugs.gentoo.org/691248 Signed-off-by: Michał Górny gentoo.org> dev-python/pydot/files/pydot-1.4.1-unittest.patch | 74 +++++++++++++++++++++++ dev-python/pydot/pydot-1.4.1.ebuild | 4 ++ 2 files changed, 78 insertions(+) diff --git a/dev-python/pydot/files/pydot-1.4.1-unittest.patch b/dev-python/pydot/files/pydot-1.4.1-unittest.patch new file mode 100644 index 00000000000..b3c0d0e426b --- /dev/null +++ b/dev-python/pydot/files/pydot-1.4.1-unittest.patch @@ -0,0 +1,74 @@ +From a10ced4d132361027a545a471af4541dea8c5cf5 Mon Sep 17 00:00:00 2001 +From: Peter Nowee +Date: Wed, 26 Jun 2019 15:43:38 +0800 +Subject: [PATCH] Fix multi.dot Graphviz regression test + +Commit d6602ad of 2018-12-01 fixed the regression test broken by commit +2d55978 of 2016-07-01. This revealed that `test/graphs/multi.dot` was +failing. + +`multi.dot` was introduced in commit 2b3f088 of 2010-11-07 together +with many of the other tests still here today. It has not been touched +since. It is a DOT-file containing two digraphs. The regression test +compares the JPEG images rendered from the DOT-file by pydot with those +rendered by Graphviz's dot directly. + +Commit 66734d2 of 2016-07-01 is the actual cause of the failure. It +changed one of the render methods of the regression test, +`_render_with_pydot`, from calculating a single hash for all the JPEG +images to calculating separate hashes for each JPEG image and then +concatenating those hashes in one long string. The other render method, +`_render_with_graphviz`, still calculates a single hash over all data. +For DOT-files that generate only one image the end result is the same, +but because `multi.dot` has two graphs, it produces two images and this +leads to comparing a string of two hashes with one single hash. + +I do not think the change in generating the hash was intentional, for +the following reasons: +- Commit 66734d2 states that its purpose was to adapt the test to an + API change in pydot. It does not mention a deliberate choice to + change the testing method. +- There was no effort to change `_render_with_graphviz` to also produce + multiple hashes. +- Except for easier debugging in case of a failing test with multiple + images (AFAICT, only `multi.dot`), I do not see much added benefit in + checking a concatenation of the hashes of all images vs. checking one + hash of all images together: In both cases the test will fail if one + or more images is rendered differently. +- Given that there were many commits authored that same hour, including + commit 2d55978 which broke the regression tests, I suspect the author + did not run the tests for each individual commit, but only at the end + of that batch, and was therefore also not alerted of this change by + the test suite. + +Assuming that the change was not intended, this commit will now revert +`_render_with_pydot` to the old behavior of calculating a single hash +from all JPEG image data. + +Tested with Debian 9.9, Graphviz 2.38.0-17, Python 2.7.13-2 and 3.5.3-1. + +Fixes https://github.com/pydot/pydot/issues/204. +--- + test/pydot_unittest.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/test/pydot_unittest.py b/test/pydot_unittest.py +index 881ee16..64aa856 100644 +--- a/test/pydot_unittest.py ++++ b/test/pydot_unittest.py +@@ -194,11 +194,11 @@ def _render_with_graphviz(self, filename, encoding): + + def _render_with_pydot(self, filename, encoding): + c = pydot.graph_from_dot_file(filename, encoding=encoding) +- sha = '' ++ jpe_data = bytearray() + for g in c: +- jpe_data = g.create(prog=TEST_PROGRAM, format='jpe', encoding=encoding) +- sha += sha256(jpe_data).hexdigest() +- return sha ++ jpe_data.extend(g.create(prog=TEST_PROGRAM, format='jpe', ++ encoding=encoding)) ++ return sha256(jpe_data).hexdigest() + + def test_my_regression_tests(self): + path = os.path.join(test_dir, TESTS_DIR_1) diff --git a/dev-python/pydot/pydot-1.4.1.ebuild b/dev-python/pydot/pydot-1.4.1.ebuild index fb2062cdb6d..1a3e1140998 100644 --- a/dev-python/pydot/pydot-1.4.1.ebuild +++ b/dev-python/pydot/pydot-1.4.1.ebuild @@ -24,6 +24,10 @@ DEPEND="${RDEPEND} dev-python/setuptools[${PYTHON_USEDEP}] test? ( dev-python/chardet[${PYTHON_USEDEP}] )" +PATCHES=( + "${FILESDIR}"/${P}-unittest.patch +) + python_test() { cd test || die "${PYTHON}" pydot_unittest.py || die "Test failed with ${EPYTHON}"