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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6C47C15815E for ; Fri, 9 Feb 2024 21:09:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 82CFDE2A7B; Fri, 9 Feb 2024 21:09:10 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3A2FBE2A7B for ; Fri, 9 Feb 2024 21:09:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 77709343186 for ; Fri, 9 Feb 2024 21:09:09 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 289F714BD for ; Fri, 9 Feb 2024 21:09:07 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1707512912.fc6cace9fddfa3a2c5567e35156b2ee7ef39dce1.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/tests/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/tests/dbapi/test_auxdb.py X-VCS-Directories: lib/portage/tests/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: fc6cace9fddfa3a2c5567e35156b2ee7ef39dce1 X-VCS-Branch: master Date: Fri, 9 Feb 2024 21:09:07 +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: 3c5f81c4-ccdb-4f78-90ed-1e6f260ce4fe X-Archives-Hash: 591673d5aa275e351b51bb70a92482a1 commit: fc6cace9fddfa3a2c5567e35156b2ee7ef39dce1 Author: Zac Medico gentoo org> AuthorDate: Fri Feb 9 21:03:55 2024 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Feb 9 21:08:32 2024 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=fc6cace9 AuxdbTestCase: Add missing playground cleanup Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/dbapi/test_auxdb.py | 67 ++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/lib/portage/tests/dbapi/test_auxdb.py b/lib/portage/tests/dbapi/test_auxdb.py index c11eed73e8..0de0123a5f 100644 --- a/lib/portage/tests/dbapi/test_auxdb.py +++ b/lib/portage/tests/dbapi/test_auxdb.py @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Gentoo Authors +# Copyright 2020-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import functools @@ -64,41 +64,50 @@ class AuxdbTestCase(TestCase): user_config={"modules": (f"portdbapi.auxdbmodule = {auxdbmodule}",)}, ) - portdb = playground.trees[playground.eroot]["porttree"].dbapi - metadata_keys = ["DEFINED_PHASES", "DEPEND", "EAPI", "INHERITED"] - - test_func = functools.partial( - self._run_test_mod_async, ebuilds, metadata_keys, portdb - ) - - results = test_func() - - self._compare_results( - ebuilds, eclass_defined_phases, eclass_depend, ebuild_inherited, results - ) + try: + portdb = playground.trees[playground.eroot]["porttree"].dbapi + metadata_keys = ["DEFINED_PHASES", "DEPEND", "EAPI", "INHERITED"] - loop = asyncio._wrap_loop() - picklable_or_fork = picklable or multiprocessing.get_start_method == "fork" - if picklable_or_fork: - results = loop.run_until_complete( - loop.run_in_executor(ForkExecutor(), test_func) + test_func = functools.partial( + self._run_test_mod_async, ebuilds, metadata_keys, portdb ) + results = test_func() + self._compare_results( ebuilds, eclass_defined_phases, eclass_depend, ebuild_inherited, results ) - auxdb = portdb.auxdb[portdb.getRepositoryPath("test_repo")] - cpv = next(iter(ebuilds)) - - modify_auxdb = functools.partial(self._modify_auxdb, auxdb, cpv) - - if multiproc and picklable_or_fork: - loop.run_until_complete(loop.run_in_executor(ForkExecutor(), modify_auxdb)) - else: - modify_auxdb() - - self.assertEqual(auxdb[cpv]["RESTRICT"], "test") + loop = asyncio._wrap_loop() + picklable_or_fork = picklable or multiprocessing.get_start_method == "fork" + if picklable_or_fork: + results = loop.run_until_complete( + loop.run_in_executor(ForkExecutor(), test_func) + ) + + self._compare_results( + ebuilds, + eclass_defined_phases, + eclass_depend, + ebuild_inherited, + results, + ) + + auxdb = portdb.auxdb[portdb.getRepositoryPath("test_repo")] + cpv = next(iter(ebuilds)) + + modify_auxdb = functools.partial(self._modify_auxdb, auxdb, cpv) + + if multiproc and picklable_or_fork: + loop.run_until_complete( + loop.run_in_executor(ForkExecutor(), modify_auxdb) + ) + else: + modify_auxdb() + + self.assertEqual(auxdb[cpv]["RESTRICT"], "test") + finally: + playground.cleanup() def _compare_results( self, ebuilds, eclass_defined_phases, eclass_depend, ebuild_inherited, results