public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/, PMSTestSuite/library/standard/basic/
Date: Fri, 17 Jun 2011 14:28:36 +0000 (UTC)	[thread overview]
Message-ID: <e9d3a675ab2e8aa3438e6918ffda30f18fed1992.mgorny@gentoo> (raw)

commit:     e9d3a675ab2e8aa3438e6918ffda30f18fed1992
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 17 13:50:41 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jun 17 13:50:41 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=e9d3a675

Add a D-Bus variant of dependency test case.

---
 PMSTestSuite/library/standard/basic/depend.py |   11 ++++----
 PMSTestSuite/library/standard/dbus_case.py    |   33 +++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/PMSTestSuite/library/standard/basic/depend.py b/PMSTestSuite/library/standard/basic/depend.py
index ef832a0..c91a107 100644
--- a/PMSTestSuite/library/standard/basic/depend.py
+++ b/PMSTestSuite/library/standard/basic/depend.py
@@ -2,8 +2,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-from PMSTestSuite.library.standard.dbus_case import DBusEbuildTestCase
-from PMSTestSuite.library.depend_case import EbuildDependencyTestCase
+from PMSTestSuite.library.standard.dbus_case import DBusEbuildTestCase, DBusEbuildDependencyTestCase
 
 class EbuildToucher(DBusEbuildTestCase):
 	""" Touched file installer (for dependency tests). """
@@ -24,26 +23,26 @@ _EOF_'''
 			'newbin mytrue.sh pms-test-suite-%s || die' % self.pv
 		)
 
-class DependTest(EbuildDependencyTestCase):
+class DependTest(DBusEbuildDependencyTestCase):
 	""" DEPEND fulfilling test. """
 
 	relevant_eapis = (0,)
 	depend_classes = [EbuildToucher]
 
 	def __init__(self, *args, **kwargs):
-		EbuildDependencyTestCase.__init__(self, *args, **kwargs)
+		DBusEbuildDependencyTestCase.__init__(self, *args, **kwargs)
 		self.phase_funcs['src_compile'].append(
 			'pms-test-suite-%s || die' % self.depend_objs[0].pv
 		)
 		
-class RDependTest(EbuildDependencyTestCase):
+class RDependTest(DBusEbuildDependencyTestCase):
 	""" RDEPEND fulfilling test. """
 
 	relevant_eapis = (0,)
 	rdepend_classes = [EbuildToucher]
 
 	def __init__(self, *args, **kwargs):
-		EbuildDependencyTestCase.__init__(self, *args, **kwargs)
+		DBusEbuildDependencyTestCase.__init__(self, *args, **kwargs)
 		self.phase_funcs['pkg_postinst'].append(
 			'pms-test-suite-%s || die' % self.rdepend_objs[0].pv
 		)

diff --git a/PMSTestSuite/library/standard/dbus_case.py b/PMSTestSuite/library/standard/dbus_case.py
index 970c897..d67c11b 100644
--- a/PMSTestSuite/library/standard/dbus_case.py
+++ b/PMSTestSuite/library/standard/dbus_case.py
@@ -5,6 +5,8 @@
 import dbus.service
 
 from PMSTestSuite.library.case import EbuildTestCase
+from PMSTestSuite.library.depend_case import EbuildDependencyTestCase
+
 from PMSTestSuite.dbus_handler import DBusHandler, dbus_interface_name, dbus_object_prefix
 
 dbus_handler = DBusHandler()
@@ -103,3 +105,34 @@ class DBusEbuildTestCase(EbuildTestCase):
 	def check_result(self, pm):
 		return self.dbus_started \
 			and self.check_dbus_result('\n'.join(self.dbus_output), pm)
+
+class DBusEbuildDependencyTestCase(EbuildDependencyTestCase):
+	""" D-Bus capable dependency test case. """
+
+	inherits = ['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 = 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')
+
+	def check_dbus_result(self, output, pm):
+		"""
+		Check whether the <output> 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)
+
+	def check_result(self, pm):
+		return self.dbus_started \
+			and self.check_dbus_result('\n'.join(self.dbus_output), pm)



             reply	other threads:[~2011-06-17 14:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-17 14:28 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-06-14 12:35 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/, PMSTestSuite/library/standard/basic/ Michał Górny
2011-06-14  8:32 Michał Górny
2011-06-03 17:36 Michał Górny
2011-06-03  5:51 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e9d3a675ab2e8aa3438e6918ffda30f18fed1992.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox