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/
Date: Wed,  3 Aug 2011 17:10:49 +0000 (UTC)	[thread overview]
Message-ID: <dd2fa7259ef32b24afcc06d7408b380311e094ab.mgorny@gentoo> (raw)

commit:     dd2fa7259ef32b24afcc06d7408b380311e094ab
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  3 16:51:15 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Aug  3 16:51:15 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=dd2fa725

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/library/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 <l> to the test output. """
 		self.test.dbus_output.append(l)
 
-class DBusEbuildTestCase(EbuildTestCase):
-	""" D-Bus capable base test case. """
+class DBusBaseTestCase(object):
+	""" A base D-Bus test case class. """
 
 	inherits = ['pms-test-dbus']
 
-	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 = RunningTest(self)
 
 	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
 
 	def check_result(self, pm):
 		self.assertTrue(self.dbus_started, 'build started')
 		return self.check_dbus_result('\n'.join(self.dbus_output), pm)
 
-class DBusEclassTestCase(EclassTestCase):
-	""" D-Bus capable eclass test case. """
-
-	inherits = ['pms-test-dbus']
+class DBusEbuildTestCase(DBusBaseTestCase, EbuildTestCase):
+	""" D-Bus capable base test case. """
 
 	def __init__(self, *args, **kwargs):
 		""" Initialize the test case and the D-Bus object for it. """
-		EclassTestCase.__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')
+		EbuildTestCase.__init__(self, *args, **kwargs)
+		DBusBaseTestCase.__init__(self)
 
 	def check_dbus_result(self, output, pm):
-		"""
-		Check whether the <output> sent through D-Bus matches expected test
-		output.
+		return EbuildTestCase.check_result(self, pm)
 
-		Return True if it does, False otherwise.
+class DBusEclassTestCase(DBusBaseTestCase, EclassTestCase):
+	""" D-Bus capable eclass test case. """
 
-		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)
 
-	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)
 
-class DBusEbuildDependencyTestCase(EbuildDependencyTestCase):
+class DBusEbuildDependencyTestCase(DBusBaseTestCase, 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')
+		DBusBaseTestCase.__init__(self)
 
 	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):
@@ -171,31 +144,15 @@ class DBusEbuildDependencyTestCase(EbuildDependencyTestCase):
 				'build started')
 		return self.check_dbus_result('\n'.join(self.dbus_output), pm)
 
-class DBusEclassDependencyTestCase(EclassDependencyTestCase):
+class DBusEclassDependencyTestCase(DBusBaseTestCase, EclassDependencyTestCase):
 	""" D-Bus capable eclass dependency test case. """
 
-	inherits = ['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 = 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)
 
 	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 EclassDependencyTestCase.check_result().
-		"""
 		return EclassDependencyTestCase.check_result(self, pm)
 
 	def check_result(self, pm):



             reply	other threads:[~2011-08-03 17:10 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-03 17:10 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-06-20  8:01 [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/standard/ Michał Górny
2012-01-03 17:50 Michał Górny
2012-01-03 17:50 Michał Górny
2012-01-03 15:52 Michał Górny
2011-08-13  8:54 Michał Górny
2011-08-12 20:55 Michał Górny
2011-08-08  2:56 Michał Górny
2011-08-07 14:57 Michał Górny
2011-08-07 14:57 Michał Górny
2011-08-07 14:48 Michał Górny
2011-08-06 14:25 Michał Górny
2011-08-06  8:31 Michał Górny
2011-08-06  8:31 Michał Górny
2011-08-05 21:36 Michał Górny
2011-08-05 21:36 Michał Górny
2011-08-05 21:36 Michał Górny
2011-08-05 21:36 Michał Górny
2011-08-05 10:04 Michał Górny
2011-08-05  8:54 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03 17:10 Michał Górny
2011-08-03 17:10 Michał Górny
2011-08-03  8:17 Michał Górny
2011-08-02 18:53 Michał Górny
2011-08-02 18:53 Michał Górny
2011-07-28 17:15 Michał Górny
2011-07-27 16:50 Michał Górny
2011-07-27 16:50 Michał Górny
2011-07-27 16:50 Michał Górny
2011-07-26 17:34 Michał Górny
2011-07-24 14:37 Michał Górny
2011-07-24 14:37 Michał Górny
2011-07-18  6:32 Michał Górny
2011-07-18  6:32 Michał Górny
2011-06-29 17:52 Michał Górny
2011-06-29 12:58 Michał Górny
2011-06-28 16:15 Michał Górny
2011-06-28 16:15 Michał Górny
2011-06-25  8:39 Michał Górny
2011-06-24 18:03 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/ Michał Górny
2011-06-24 18:03 Michał Górny
2011-06-24 18:03 Michał Górny
2011-06-23 21:14 Michał Górny
2011-06-23 21:14 Michał Górny
2011-06-23  9:51 Michał Górny
2011-06-22 19:53 Michał Górny
2011-06-22 13:32 Michał Górny
2011-06-17 14:28 Michał Górny
2011-06-17 14:28 Michał Górny
2011-06-17 14:28 Michał Górny
2011-05-31 19:18 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=dd2fa7259ef32b24afcc06d7408b380311e094ab.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