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 1QoeyB-0003Z6-26 for garchives@archives.gentoo.org; Wed, 03 Aug 2011 17:10:59 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EDE3D21C023; Wed, 3 Aug 2011 17:10:50 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id AF4F021C023 for ; Wed, 3 Aug 2011 17:10:50 +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 ECD491B4031 for ; Wed, 3 Aug 2011 17:10:49 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 4DD298003C for ; Wed, 3 Aug 2011 17:10:49 +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:master commit in: pmstestsuite/library/standard/ X-VCS-Repository: proj/pms-test-suite X-VCS-Files: pmstestsuite/library/standard/dbus_case.py X-VCS-Directories: pmstestsuite/library/standard/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: dd2fa7259ef32b24afcc06d7408b380311e094ab Date: Wed, 3 Aug 2011 17:10:49 +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: 05579455d57f8f5e0d16d5df21a48974 commit: dd2fa7259ef32b24afcc06d7408b380311e094ab Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Wed Aug 3 16:51:15 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Wed Aug 3 16:51:15 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e.git;a=3Dcommit;h=3Ddd2fa725 Commonize some of D-Bus test cases code. --- pmstestsuite/library/standard/dbus_case.py | 85 +++++++---------------= ------ 1 files changed, 21 insertions(+), 64 deletions(-) diff --git a/pmstestsuite/library/standard/dbus_case.py b/pmstestsuite/li= brary/standard/dbus_case.py index e69e4de..eb88fa1 100644 --- a/pmstestsuite/library/standard/dbus_case.py +++ b/pmstestsuite/library/standard/dbus_case.py @@ -77,14 +77,12 @@ class RunningTest(dbus.service.Object): """ Append the line to the test output. """ self.test.dbus_output.append(l) =20 -class DBusEbuildTestCase(EbuildTestCase): - """ D-Bus capable base test case. """ +class DBusBaseTestCase(object): + """ A base D-Bus test case class. """ =20 inherits =3D ['pms-test-dbus'] =20 - def __init__(self, *args, **kwargs): - """ Initialize the test case and the D-Bus object for it. """ - EbuildTestCase.__init__(self, *args, **kwargs) + def __init__(self): self._dbusobj =3D RunningTest(self) =20 def _finalize(self): @@ -102,68 +100,43 @@ class DBusEbuildTestCase(EbuildTestCase): The default implementation simply checks whether the test was merged alike EbuildTestCase.check_result(). """ - return EbuildTestCase.check_result(self, pm) + pass =20 def check_result(self, pm): self.assertTrue(self.dbus_started, 'build started') return self.check_dbus_result('\n'.join(self.dbus_output), pm) =20 -class DBusEclassTestCase(EclassTestCase): - """ D-Bus capable eclass test case. """ - - inherits =3D ['pms-test-dbus'] +class DBusEbuildTestCase(DBusBaseTestCase, EbuildTestCase): + """ D-Bus capable base test case. """ =20 def __init__(self, *args, **kwargs): """ Initialize the test case and the D-Bus object for it. """ - EclassTestCase.__init__(self, *args, **kwargs) - self._dbusobj =3D RunningTest(self) - - def _finalize(self): - """ Finalize the object, ensuring pkg_setup() will be called. """ - if self.phase_funcs['pkg_setup']: - self.phase_funcs['pkg_setup'].insert(0, 'pms-test-dbus_pkg_setup') + EbuildTestCase.__init__(self, *args, **kwargs) + DBusBaseTestCase.__init__(self) =20 def check_dbus_result(self, output, pm): - """ - Check whether the sent through D-Bus matches expected test - output. + return EbuildTestCase.check_result(self, pm) =20 - Return True if it does, False otherwise. +class DBusEclassTestCase(DBusBaseTestCase, EclassTestCase): + """ D-Bus capable eclass test case. """ =20 - The default implementation simply checks whether the test was merged - alike EbuildTestCase.check_result(). - """ - return EbuildTestCase.check_result(self, pm) + def __init__(self, *args, **kwargs): + """ Initialize the test case and the D-Bus object for it. """ + EclassTestCase.__init__(self, *args, **kwargs) + DBusBaseTestCase.__init__(self) =20 - def check_result(self, pm): - self.assertTrue(self.dbus_started, 'build started') - return self.check_dbus_result('\n'.join(self.dbus_output), pm) + def check_dbus_result(self, output, pm): + return EclassTestCase.check_result(self, pm) =20 -class DBusEbuildDependencyTestCase(EbuildDependencyTestCase): +class DBusEbuildDependencyTestCase(DBusBaseTestCase, EbuildDependencyTes= tCase): """ D-Bus capable dependency test case. """ =20 - inherits =3D ['pms-test-dbus'] - def __init__(self, *args, **kwargs): """ Initialize the test case and the D-Bus object for it. """ EbuildDependencyTestCase.__init__(self, *args, **kwargs) - self._dbusobj =3D RunningTest(self) - - def _finalize(self): - """ Finalize the object, ensuring pkg_setup() will be called. """ - if self.phase_funcs['pkg_setup']: - self.phase_funcs['pkg_setup'].insert(0, 'pms-test-dbus_pkg_setup') + DBusBaseTestCase.__init__(self) =20 def check_dbus_result(self, output, pm): - """ - Check whether the sent through D-Bus matches expected test - output. - - Return True if it does, False otherwise. - - The default implementation simply checks whether the test was merged - alike EbuildDependencyTestCase.check_result(). - """ return EbuildDependencyTestCase.check_result(self, pm) =20 def check_result(self, pm): @@ -171,31 +144,15 @@ class DBusEbuildDependencyTestCase(EbuildDependency= TestCase): 'build started') return self.check_dbus_result('\n'.join(self.dbus_output), pm) =20 -class DBusEclassDependencyTestCase(EclassDependencyTestCase): +class DBusEclassDependencyTestCase(DBusBaseTestCase, EclassDependencyTes= tCase): """ D-Bus capable eclass dependency test case. """ =20 - inherits =3D ['pms-test-dbus'] - def __init__(self, *args, **kwargs): """ Initialize the test case and the D-Bus object for it. """ EclassDependencyTestCase.__init__(self, *args, **kwargs) - self._dbusobj =3D RunningTest(self) - - def _finalize(self): - """ Finalize the object, ensuring pkg_setup() will be called. """ - if self.phase_funcs['pkg_setup']: - self.phase_funcs['pkg_setup'].insert(0, 'pms-test-dbus_pkg_setup') + DBusBaseTestCase.__init__(self) =20 def check_dbus_result(self, output, pm): - """ - Check whether the sent through D-Bus matches expected test - output. - - Return True if it does, False otherwise. - - The default implementation simply checks whether the test was merged - alike EclassDependencyTestCase.check_result(). - """ return EclassDependencyTestCase.check_result(self, pm) =20 def check_result(self, pm):