From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QWP39-0006a4-4q for garchives@archives.gentoo.org; Tue, 14 Jun 2011 08:32:39 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 39F1B1C041; Tue, 14 Jun 2011 08:32:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 04B8C1C041 for ; Tue, 14 Jun 2011 08:32:16 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 80FC21B4021 for ; Tue, 14 Jun 2011 08:32:16 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id E0AF28003E for ; Tue, 14 Jun 2011 08:32:15 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <0ab45433e1c2e28a592f4c2101a7c9f6a82a2277.mgorny@gentoo> Subject: [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/ X-VCS-Repository: proj/pms-test-suite X-VCS-Files: PMSTestSuite/library/case.py X-VCS-Directories: PMSTestSuite/library/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 0ab45433e1c2e28a592f4c2101a7c9f6a82a2277 Date: Tue, 14 Jun 2011 08:32:15 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: c60768e6f4946892727351e240d1cff2 commit: 0ab45433e1c2e28a592f4c2101a7c9f6a82a2277 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Tue Jun 14 07:23:21 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Tue Jun 14 07:26:07 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e.git;a=3Dcommit;h=3D0ab45433 Support test case object finalization. This allows superclasses to perform additional modifications or checks before outputting the files. --- PMSTestSuite/library/case.py | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/PMSTestSuite/library/case.py b/PMSTestSuite/library/case.py index d3e1126..291149b 100644 --- a/PMSTestSuite/library/case.py +++ b/PMSTestSuite/library/case.py @@ -43,7 +43,13 @@ def cleanup_test_case_name(classname): =20 class TestCase(object): """ Base class for a test case. """ - pass + + def _finalize(self): + """ + Do any final modifications to test case data. Mark it finalized. + This function shall be called at most once per object. + """ + self._finalized =3D True =20 class EbuildTestCase(TestCase): """ @@ -66,6 +72,8 @@ class EbuildTestCase(TestCase): inherits =3D [] phase_funcs =3D {} =20 + _finalized =3D False + @classmethod def inst_all(cls, *args, **kwargs): """ @@ -127,6 +135,9 @@ class EbuildTestCase(TestCase): =20 return ''.join(contents) =20 + if not self._finalized: + self._finalize() + fn =3D 'pms-test/%s/%s.ebuild' % (self.pn, self.p) =20 return {fn: EbuildTestCaseEbuildFile(self)}