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 1QWCdH-0004KL-Q3 for garchives@archives.gentoo.org; Mon, 13 Jun 2011 19:17:08 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E3BFA1C00A; Mon, 13 Jun 2011 19:16:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id A0C881C00A for ; Mon, 13 Jun 2011 19:16:58 +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 1B4291B401D for ; Mon, 13 Jun 2011 19:16:58 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 73B4F8003C for ; Mon, 13 Jun 2011 19:16:57 +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: <4848a6e5cf8b0d5a76badd80f04d76aa0aa7cf0b.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: 4848a6e5cf8b0d5a76badd80f04d76aa0aa7cf0b Date: Mon, 13 Jun 2011 19:16:57 +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: d58f02cc1ec334b3cf31f7a978666303 commit: 4848a6e5cf8b0d5a76badd80f04d76aa0aa7cf0b Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Mon Jun 13 18:53:31 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Mon Jun 13 18:53:31 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e.git;a=3Dcommit;h=3D4848a6e5 Copy test lists and dicts when instantiating. This way, we can avoid sharing data between different instances of the test class and make modifying it much easier. --- PMSTestSuite/library/case.py | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/PMSTestSuite/library/case.py b/PMSTestSuite/library/case.py index d063ce3..5f58b41 100644 --- a/PMSTestSuite/library/case.py +++ b/PMSTestSuite/library/case.py @@ -2,7 +2,7 @@ # (c) 2011 Micha=C5=82 G=C3=B3rny # Released under the terms of the 2-clause BSD license. =20 -import re +import copy, re =20 # XXX: move to some consts module? phase_func_names =3D [ @@ -50,16 +50,21 @@ class EbuildTestCase(TestCase): Test case using a single ebuild (per EAPI). =09 Properties: - - ebuild_vars - additional global variables (a list), + - ebuild_vars - additional global variables (a dict of strings), - expect_failure - if set to False (the default), the test is supposed to merge successfully. Otherwise, the test ebuild is supposed to fail to merge (die), - - inherits - additional eclasses to inherit (a list), + - inherits - additional eclasses to inherit (a list of strings), - phase_funcs - phase function contents (a dict of lists). + + The __init__() function is going to clone (deepcopy()) all the above + properties to allow modifying instance variables easily. """ =20 + ebuild_vars =3D {} expect_failure =3D False inherits =3D [] + phase_funcs =3D {} =20 @classmethod def inst_all(cls, *args, **kwargs): @@ -83,6 +88,9 @@ class EbuildTestCase(TestCase): self.pn =3D cleanup_test_case_name(self.__class__.__name__) self.p =3D '%s-%s' % (self.pn, eapi) =20 + for v in ('ebuild_vars', 'inherits', 'phase_funcs'): + setattr(self, v, copy.deepcopy(getattr(self, v))) + def get_output_files(self): """ Get a dict of files to output in the repository for the test case.