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 1QMPk5-0008Ty-Pl for garchives@archives.gentoo.org; Tue, 17 May 2011 19:15:42 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 256E01C1C1; Tue, 17 May 2011 19:15:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id EBFB01C1C1 for ; Tue, 17 May 2011 19:15:18 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6C3851B400E for ; Tue, 17 May 2011 19:15:18 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id D6E1480504 for ; Tue, 17 May 2011 19:15:17 +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: Subject: [gentoo-commits] proj/pms-test-suite-library:master commit in: basic/ X-VCS-Repository: proj/pms-test-suite-library X-VCS-Files: basic/phase-function-order.py X-VCS-Directories: basic/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: d5c095938cbe524e92a03ad366c0aca62f35fdc3 Date: Tue, 17 May 2011 19:15:17 +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: 346c425aae3d2fefdeaa32527c2ace08 commit: d5c095938cbe524e92a03ad366c0aca62f35fdc3 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Tue May 17 19:09:42 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Tue May 17 19:09:42 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e-library.git;a=3Dcommit;h=3Dd5c09593 Add a Python library format example. --- basic/phase-function-order.py | 73 +++++++++++++++++++++++++++++++++++= ++++++ 1 files changed, 73 insertions(+), 0 deletions(-) diff --git a/basic/phase-function-order.py b/basic/phase-function-order.p= y new file mode 100644 index 0000000..59307f9 --- /dev/null +++ b/basic/phase-function-order.py @@ -0,0 +1,73 @@ +# Example Python implementation + +# XXX: will be implemented in core suite and imported here +class EbuildTest(object): + phase_funcs =3D dict([(func, []) for func in ( + 'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare', + 'src_configure', 'src_compile', 'src_install', + 'pkg_preinst', 'pkg_postinst' + )]) + +class PhaseFunctionOrderTest(EbuildTest): + relevant_eapis =3D (0, 2, 4) + + DESCRIPTION =3D 'Phase function execution order test' + + def __init__(self): + for func in self.phase_funcs.keys(): + self.phase_funcs[func].append("pms-test_append_result %s" % func) + + def check_output(self, output): + if self.EAPI < 2: + expect =3D """pkg_setup +src_unpack +src_compile +src_install +pkg_preinst +pkg_postinst""" + elif self.EAPI < 4: + expect =3D """pkg_setup +src_unpack +src_prepare +src_compile +src_configure +src_install +pkg_preinst +pkg_postinst""" + else: + expect =3D """pkg_pretend +pkg_setup +src_unpack +src_prepare +src_compile +src_configure +src_install +pkg_preinst +pkg_postinst""" + + return (output =3D=3D expect) + +# (test code) +test =3D PhaseFunctionOrderTest() + +test.EAPI=3D1 +real_output=3D"""pkg_setup +src_unpack +src_compile +src_install +pkg_preinst +pkg_postinst""" +print(test.check_output(real_output)) # expect True + +test.EAPI=3D2 +print(test.check_output(real_output)) # expect False + +real_output=3D"""pkg_setup +src_unpack +src_prepare +src_compile +src_configure +src_install +pkg_preinst +pkg_postinst""" +print(test.check_output(real_output)) # expect True