public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/, PMSTestSuite/
@ 2011-05-31 21:06 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2011-05-31 21:06 UTC (permalink / raw
  To: gentoo-commits

commit:     4ec2cf8922a03e3654fc0d18f89f2385a763bff2
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue May 31 21:01:27 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue May 31 21:01:27 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=4ec2cf89

Fix grabbing CPV for tests.

---
 PMSTestSuite/library/case.py |    5 +++++
 PMSTestSuite/testrunner.py   |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/PMSTestSuite/library/case.py b/PMSTestSuite/library/case.py
index f02a5e1..8d70f93 100644
--- a/PMSTestSuite/library/case.py
+++ b/PMSTestSuite/library/case.py
@@ -68,6 +68,11 @@ class EbuildTestCase(TestCase):
 			kwargs['eapi'] = eapi
 			yield cls(*args, **kwargs)
 
+	@property
+	def cpv(self):
+		""" Return CPV for the test. """
+		return 'pms-test/%s' % self.p
+
 	def __init__(self, eapi):
 		""" Instiantate the test case for a particular EAPI. """
 		self.eapi = eapi

diff --git a/PMSTestSuite/testrunner.py b/PMSTestSuite/testrunner.py
index f642aaa..ced3b3c 100644
--- a/PMSTestSuite/testrunner.py
+++ b/PMSTestSuite/testrunner.py
@@ -8,7 +8,7 @@ class TestRunnerCLI(EbuildGenCLI):
 
 		cpvs = frozenset(self.pm.lookup_vardb(self.cpvs))
 		for t in self.test_library:
-			res = t.check_result(t.p in cpvs)
+			res = t.check_result(t.cpv in cpvs)
 			if not res:
 				failed.append(t)
 
@@ -30,7 +30,7 @@ class TestRunnerCLI(EbuildGenCLI):
 			return ret
 
 		self.pm.append_repository(self.repository)
-		self.cpvs = [t.p for t in self.test_library]
+		self.cpvs = [t.cpv for t in self.test_library]
 
 		installedcpvs = self.pm.lookup_vardb(self.cpvs)
 		if installedcpvs:



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/, PMSTestSuite/
@ 2011-06-03 17:36 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2011-06-03 17:36 UTC (permalink / raw
  To: gentoo-commits

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

Allow test libraries to supply common files as well.

---
 PMSTestSuite/cli.py              |    1 +
 PMSTestSuite/library/__init__.py |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/PMSTestSuite/cli.py b/PMSTestSuite/cli.py
index 0824cbf..15745d8 100644
--- a/PMSTestSuite/cli.py
+++ b/PMSTestSuite/cli.py
@@ -118,6 +118,7 @@ class PMSTestSuiteCLI(object):
 		for t in self.test_library:
 			files.update(t.get_output_files())
 		files.update(get_common_eclass_files())
+		files.update(self.test_library.get_common_files())
 
 		self.repository.write_files(files)
 		self.repository.remanifest(files, self.pm)

diff --git a/PMSTestSuite/library/__init__.py b/PMSTestSuite/library/__init__.py
index a473888..bcf8f6f 100644
--- a/PMSTestSuite/library/__init__.py
+++ b/PMSTestSuite/library/__init__.py
@@ -53,6 +53,10 @@ class TestLibrary(object):
 	def __init__(self, modname):
 		self.modname = modname
 
+	def get_common_files(self):
+		""" Return common files necessary for the library (e.g. eclasses). """
+		return {}
+
 def load_library(name):
 	"""
 	Try to load a test library <name>. Instiantiate the first TestLibrary



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/, PMSTestSuite/
@ 2011-06-16 19:49 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2011-06-16 19:49 UTC (permalink / raw
  To: gentoo-commits

commit:     b55f0a9f55ce0fba583f2f1eba597a8959d67f90
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 16 19:19:14 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jun 16 19:19:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=b55f0a9f

Introduce test API to handle merges/unmerges.

---
 PMSTestSuite/cli.py          |    8 +++++---
 PMSTestSuite/library/case.py |   19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/PMSTestSuite/cli.py b/PMSTestSuite/cli.py
index 183c3a3..3573c85 100644
--- a/PMSTestSuite/cli.py
+++ b/PMSTestSuite/cli.py
@@ -110,11 +110,11 @@ class PMSTestSuiteCLI(object):
 			res = t.check_result(self.pm)
 			if not res:
 				self.failed.append(t)
+			t.clean(self.pm)
 
 		self.merged_pkgs = frozenset(self.pm.lookup_vardb(self.cpvs))
 		if self.merged_pkgs:
 			print('-> Unmerging test ebuilds...')
-			self.pm.unmerge(self.merged_pkgs)
 			self.pm.commit(self.all_done)
 		else:
 			self.all_done()
@@ -134,7 +134,8 @@ class PMSTestSuiteCLI(object):
 
 	def start_pm(self):
 		print('-> Running PM...')
-		self.pm.merge(self.package_queue)
+		for t in self.test_library:
+			t.start(self.pm)
 		self.pm.commit(self.tests_done)
 
 	def pre_unmerge_done(self):
@@ -163,11 +164,12 @@ class PMSTestSuiteCLI(object):
 		self.cpvs = [t.cpv for t in self.test_library]
 
 		self.package_queue = list(self.cpvs)
+		for t in self.test_library:
+			t.clean(self.pm)
 
 		installedcpvs = self.pm.lookup_vardb(self.cpvs)
 		if installedcpvs:
 			print('-> Unmerging already-merged test ebuilds...')
-			self.pm.unmerge(installedcpvs)
 			self.pm.commit(self.pre_unmerge_done)
 		else:
 			self.start_pm()

diff --git a/PMSTestSuite/library/case.py b/PMSTestSuite/library/case.py
index 5718fe6..8328a5f 100644
--- a/PMSTestSuite/library/case.py
+++ b/PMSTestSuite/library/case.py
@@ -56,6 +56,18 @@ class TestCase(object):
 
 			self.ebuild_vars['DESCRIPTION'] = descdoc.rstrip('.')
 
+	def clean(self, pm):
+		"""
+		Schedule cleaning the test using PackageManager instance <pm>.
+		"""
+		raise NotImplementedError('Please override TestCase.clean()')
+
+	def start(self, pm):
+		"""
+		Schedule starting the test using PackageManager instance <pm>.
+		"""
+		raise NotImplementedError('Please override TestCase.start()')
+
 	def check_result(self, pm):
 		"""
 		Check the correctness of the result of test execution.
@@ -167,6 +179,13 @@ class EbuildTestCase(TestCase):
 
 		return {fn: EbuildTestCaseEbuildFile(self)}
 
+	def clean(self, pm):
+		if pm.lookup_vardb((self.cpv,)):
+			pm.unmerge(self.cpv)
+
+	def start(self, pm):
+		pm.merge(self.cpv)
+
 	def check_result(self, pm):
 		"""
 		Check the correctness of the result of test execution. By default,



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/, PMSTestSuite/
@ 2011-06-16 19:49 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2011-06-16 19:49 UTC (permalink / raw
  To: gentoo-commits

commit:     cfe64f1d21a3c971b7a01562aefe0be398b58620
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 16 19:43:46 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jun 16 19:43:46 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=cfe64f1d

Stringify tests when printing (to freetext description).

---
 PMSTestSuite/cli.py          |    2 +-
 PMSTestSuite/library/case.py |   11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/PMSTestSuite/cli.py b/PMSTestSuite/cli.py
index d031a4c..80b234c 100644
--- a/PMSTestSuite/cli.py
+++ b/PMSTestSuite/cli.py
@@ -126,7 +126,7 @@ class PMSTestSuiteCLI(object):
 					% (len(self.test_library) - len(self.failed),
 						len(self.test_library), len(self.failed)))
 			for t in self.failed:
-				print('- %s' % t.p)
+				print('- %s' % t)
 
 		self.ret = 0 if not self.failed else 1
 		self.loop.quit()

diff --git a/PMSTestSuite/library/case.py b/PMSTestSuite/library/case.py
index d16cedd..4126c26 100644
--- a/PMSTestSuite/library/case.py
+++ b/PMSTestSuite/library/case.py
@@ -124,13 +124,20 @@ class EbuildTestCase(TestCase):
 		""" Return CPV for the test. """
 		return 'pms-test/%s' % self.p
 
+	@property
+	def _stripped_docstring(self):
+		descdoc = ' '.join(self.__doc__.split())
+		return descdoc.rstrip('.')
+
 	def _finalize(self):
 		TestCase._finalize(self)
 
 		if 'DESCRIPTION' not in self.ebuild_vars:
-			descdoc = ' '.join(self.__doc__.split())
+			self.ebuild_vars['DESCRIPTION'] = self._stripped_docstring
 
-			self.ebuild_vars['DESCRIPTION'] = descdoc.rstrip('.')
+	def __str__(self):
+		""" Return freetext test description. """
+		return '%s (%s)' % (self.p, self._stripped_docstring)
 
 	def __init__(self, eapi):
 		""" Instiantate the test case for a particular EAPI. """



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/, PMSTestSuite/
@ 2011-06-22 13:32 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2011-06-22 13:32 UTC (permalink / raw
  To: gentoo-commits

commit:     ace8247e263ceda5b7da74299e5673180a37a6f9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 22 13:32:53 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun 22 13:32:53 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=ace8247e

Support limiting the tests to run.

---
 PMSTestSuite/cli.py              |    9 +++++++++
 PMSTestSuite/library/__init__.py |   17 +++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/PMSTestSuite/cli.py b/PMSTestSuite/cli.py
index 08caa86..342a1f2 100644
--- a/PMSTestSuite/cli.py
+++ b/PMSTestSuite/cli.py
@@ -54,6 +54,9 @@ class PMSTestSuiteCLI(object):
 				help='Name of the repository to store ebuilds in')
 		opt.add_option('-R', '--repository-path', dest='repo_path',
 				help='Path to the repository to store ebuilds in')
+		opt.add_option('-t', '--tests', dest='tests',
+				help='Limit the tests to be run (may be specified multiple times)',
+				action='append', default=[])
 
 		self.optparser = opt
 
@@ -102,6 +105,12 @@ class PMSTestSuiteCLI(object):
 
 		self.pm.package_limit = opts.limit_pkgs
 		self.update_manifests = not opts.no_manifests
+		
+		limit_tests = set()
+		for t in opts.tests:
+			limit_tests.update(t.split())
+		if limit_tests:
+			self.test_library.limit_tests(limit_tests)
 
 	def tests_done(self):
 		self.failed = []

diff --git a/PMSTestSuite/library/__init__.py b/PMSTestSuite/library/__init__.py
index 3c7f6b1..a016a80 100644
--- a/PMSTestSuite/library/__init__.py
+++ b/PMSTestSuite/library/__init__.py
@@ -63,6 +63,23 @@ class TestLibrary(object):
 	def __init__(self, modname):
 		self.modname = modname
 
+	def limit_tests(self, limitations):
+		if self.tests is not None:
+			raise SystemError('TestLibrary.limit_tests() must be called before initiating tests.')
+
+		ls = []
+		for l in limitations:
+			ls.append(l.split('.'))
+
+		newnames = set()
+		for t in self.test_names:
+			ts = t.split('.')
+			for l in ls:
+				if ts[:len(l)] == l:
+					newnames.add(t)
+
+		self.test_names = newnames
+
 	def get_common_files(self):
 		""" Return common files necessary for the library (e.g. eclasses). """
 		return {}



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/, pmstestsuite/
@ 2011-06-29 17:52 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2011-06-29 17:52 UTC (permalink / raw
  To: gentoo-commits

commit:     0fe0c4190597136b01be3700eea3c890ec1ff0c3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 29 17:40:31 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun 29 17:40:31 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=0fe0c419

Support enabling thorough mode for a library.

---
 pmstestsuite/cli.py              |    6 +++++-
 pmstestsuite/library/__init__.py |    3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pmstestsuite/cli.py b/pmstestsuite/cli.py
index 707f494..4d309f8 100644
--- a/pmstestsuite/cli.py
+++ b/pmstestsuite/cli.py
@@ -57,6 +57,9 @@ class PMSTestSuiteCLI(object):
 		opt.add_option('-t', '--tests', dest='tests',
 				help='Limit the tests to be run (may be specified multiple times)',
 				action='append', default=[])
+		opt.add_option('-T', '--thorough', dest='thorough',
+				help='Run tests thoroughly (i.e. in all possible variants)',
+				action='store_true', default=False)
 
 		self.optparser = opt
 
@@ -99,7 +102,8 @@ class PMSTestSuiteCLI(object):
 			opt.error('Repository open failed: %s' % e)
 
 		try:
-			self.test_library = load_library(opts.library_name)
+			self.test_library = load_library(opts.library_name,
+					thorough = opts.thorough)
 		except (ImportError, TypeError) as e:
 			opt.error('Test library load failed: %s' % e)
 

diff --git a/pmstestsuite/library/__init__.py b/pmstestsuite/library/__init__.py
index a638b62..6499e3f 100644
--- a/pmstestsuite/library/__init__.py
+++ b/pmstestsuite/library/__init__.py
@@ -60,8 +60,9 @@ class TestLibrary(object):
 
 		return len(self.tests)
 
-	def __init__(self, modname):
+	def __init__(self, modname, thorough = False):
 		self.modname = modname
+		self.thorough = thorough
 
 	def limit_tests(self, limitations):
 		if self.tests is not None:



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/, pmstestsuite/
@ 2011-08-06 14:25 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2011-08-06 14:25 UTC (permalink / raw
  To: gentoo-commits

commit:     752f45f2cb79d9805b71d69d771a259b100724f3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  6 13:49:41 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug  6 13:51:35 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=752f45f2

Support running tests in undefined-behavior EAPIs.

---
 pmstestsuite/cli.py              |    5 ++++-
 pmstestsuite/library/__init__.py |    6 ++++--
 pmstestsuite/library/case.py     |   15 ++++++++++++---
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/pmstestsuite/cli.py b/pmstestsuite/cli.py
index 401e83d..2b746ae 100644
--- a/pmstestsuite/cli.py
+++ b/pmstestsuite/cli.py
@@ -79,6 +79,9 @@ class PMSTestSuiteCLI(object):
 		opt.add_option('-T', '--thorough', dest='thorough',
 				help='Run tests thoroughly (i.e. in all possible variants)',
 				action='store_true', default=False)
+		opt.add_option('-U', '--unsupported-eapis', dest='undefined',
+				help='Run tests in undefined-behavior EAPIs as well',
+				action='store_true', default=False)
 		opt.add_option('-v', '--verbose', dest='verbose',
 				help='Report test results verbosely (even if they succeed)',
 				action='store_true', default=False)
@@ -150,7 +153,7 @@ class PMSTestSuiteCLI(object):
 
 		try:
 			self.test_library = load_library(opts.library_name,
-					thorough = opts.thorough)
+					thorough = opts.thorough, undefined = opts.undefined)
 		except (ImportError, TypeError) as e:
 			opt.error('Test library load failed: %s' % e)
 

diff --git a/pmstestsuite/library/__init__.py b/pmstestsuite/library/__init__.py
index c286d22..473e9b0 100644
--- a/pmstestsuite/library/__init__.py
+++ b/pmstestsuite/library/__init__.py
@@ -65,7 +65,8 @@ class TestLibrary(ABCObject):
 				modname = '%s.%s' % (self.modname, modname)
 				mod = __import__(modname, {}, {}, [clsname], 0)
 				cls = getattr(mod, clsname)
-				for i in cls.inst_all(thorough = self.thorough):
+				for i in cls.inst_all(thorough = self.thorough,
+						undefined = self.undefined):
 					self.tests.append(i)
 					yield i
 
@@ -77,9 +78,10 @@ class TestLibrary(ABCObject):
 
 		return len(self.tests)
 
-	def __init__(self, modname, thorough = False):
+	def __init__(self, modname, thorough = False, undefined = False):
 		self.modname = modname
 		self.thorough = thorough
+		self.undefined = undefined
 
 	def limit_tests(self, limitations):
 		if self.tests is not None:

diff --git a/pmstestsuite/library/case.py b/pmstestsuite/library/case.py
index 538a050..55dfa43 100644
--- a/pmstestsuite/library/case.py
+++ b/pmstestsuite/library/case.py
@@ -16,7 +16,7 @@ phase_func_names = [
 
 """ Names of all phase functions supported in EAPIs. """
 
-known_eapis = (0, 1, 2, 3, 4)
+known_eapis = frozenset((0, 1, 2, 3, 4))
 
 """ All known EAPIs. """
 
@@ -205,7 +205,7 @@ class TestCase(ABCObject):
 
 	def _append_assert(self, a, undefined = False):
 		all_eapis = itertools.chain.from_iterable(self.supported_eapis)
-		if undefined:
+		if undefined or self.eapi not in all_eapis:
 			a._undefined = True
 
 		self.assertions.append(a)
@@ -371,7 +371,7 @@ class EbuildTestCase(TestCase):
 		return (known_eapis,)
 
 	@classmethod
-	def inst_all(cls, thorough = False):
+	def inst_all(cls, thorough = False, undefined = False):
 		"""
 		Instantiate the test case, choosing a single EAPI from each EAPI group
 		listed in L{supported_eapis}. If thorough mode is enabled, all EAPIs
@@ -379,11 +379,20 @@ class EbuildTestCase(TestCase):
 
 		@param thorough: whether to use the thorough mode
 		@type thorough: bool
+		@param undefined: whether to run tests on undefined-behavior EAPIs
+		@type undefined: bool
 		@return: an iterable over test case instances
 		@rtype: generator(L{EbuildTestCase})
 		"""
 
 		supported_eapis = cls._eval_prop(cls.supported_eapis)
+
+		if undefined:
+			all_supp_eapis = set(itertools.chain.from_iterable(supported_eapis))
+			remaining = known_eapis - all_supp_eapis
+			if remaining:
+				supported_eapis = tuple(supported_eapis) + (tuple(remaining),)
+
 		if thorough:
 			eapis = itertools.chain.from_iterable(supported_eapis)
 		else:



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/, pmstestsuite/
@ 2012-01-03 15:52 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2012-01-03 15:52 UTC (permalink / raw
  To: gentoo-commits

commit:     07036b5d2418b103a78964ed1fb59c878e37ce04
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  3 10:45:41 2012 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jan  3 10:45:41 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=07036b5d

Instantiate the D-Bus handler in CLI.

---
 pmstestsuite/cli.py              |    6 +++++-
 pmstestsuite/library/__init__.py |    6 ++++--
 pmstestsuite/library/case.py     |   17 ++++++++---------
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/pmstestsuite/cli.py b/pmstestsuite/cli.py
index 8262427..3d4b79e 100644
--- a/pmstestsuite/cli.py
+++ b/pmstestsuite/cli.py
@@ -10,6 +10,7 @@ import gobject
 from optparse import OptionParser
 
 from . import PV
+from .dbus_handler import DBusHandler
 from .library import load_library
 from .repository import NewEbuildRepository
 from .repository.pms_eclass import get_common_eclass_files
@@ -155,9 +156,12 @@ class PMSTestSuiteCLI(object):
 		except (EnvironmentError, KeyError, ValueError) as e:
 			opt.error('Repository open failed: %s' % e)
 
+		dbus_hdlr = DBusHandler()
+
 		try:
 			self.test_library = load_library(opts.library_name,
-					thorough = opts.thorough, undefined = opts.undefined)
+					thorough = opts.thorough, undefined = opts.undefined,
+					dbus_hdlr = dbus_hdlr)
 		except (ImportError, TypeError) as e:
 			opt.error('Test library load failed: %s' % e)
 

diff --git a/pmstestsuite/library/__init__.py b/pmstestsuite/library/__init__.py
index eb5bade..a8adc99 100644
--- a/pmstestsuite/library/__init__.py
+++ b/pmstestsuite/library/__init__.py
@@ -66,7 +66,8 @@ class TestLibrary(ABCObject):
 				mod = __import__(modname, fromlist=[clsname], globals=globals(), level=1)
 				cls = getattr(mod, clsname)
 				for i in cls.inst_all(thorough = self.thorough,
-						undefined = self.undefined, short_name = t):
+						undefined = self.undefined, short_name = t,
+						dbus_hdlr = self.dbus_hdlr):
 					self.tests.append(i)
 					yield i
 
@@ -78,8 +79,9 @@ class TestLibrary(ABCObject):
 
 		return len(self.tests)
 
-	def __init__(self, modname, thorough = False, undefined = False):
+	def __init__(self, modname, dbus_hdlr, thorough = False, undefined = False):
 		self.modname = modname
+		self.dbus_hdlr = dbus_hdlr
 		self.thorough = thorough
 		self.undefined = undefined
 

diff --git a/pmstestsuite/library/case.py b/pmstestsuite/library/case.py
index e007cf6..7cf4b1c 100644
--- a/pmstestsuite/library/case.py
+++ b/pmstestsuite/library/case.py
@@ -9,9 +9,7 @@ import dbus.service
 
 from abc import ABCMeta, abstractmethod, abstractproperty
 
-from pmstestsuite.dbus_handler import DBusHandler, dbus_interface_name, dbus_object_prefix
-
-dbus_handler = DBusHandler()
+from pmstestsuite.dbus_handler import dbus_interface_name, dbus_object_prefix
 
 # XXX: move to some consts module?
 phase_func_names = [
@@ -244,7 +242,7 @@ class TestCase(dbus.service.Object): # was: ABCObject
 
 	_finalized = False
 
-	def __init__(self, short_name):
+	def __init__(self, short_name, dbus_hdlr):
 		"""
 		Initialize the test class and the D-Bus interface for it.
 		"""
@@ -254,7 +252,7 @@ class TestCase(dbus.service.Object): # was: ABCObject
 
 		dbus.service.Object.__init__(
 				self,
-				dbus_handler.bus,
+				dbus_hdlr.bus,
 				'%s/%s' % (dbus_object_prefix, self.p.replace('-', '_'))
 		)
 
@@ -500,7 +498,7 @@ class EbuildTestCase(TestCase):
 		return (tuple(known_eapis),)
 
 	@classmethod
-	def inst_all(cls, short_name, thorough = False, undefined = False):
+	def inst_all(cls, short_name, dbus_hdlr, thorough = False, undefined = False):
 		"""
 		Instantiate the test case, choosing a single EAPI from each EAPI group
 		listed in L{supported_eapis}. If thorough mode is enabled, all EAPIs
@@ -528,7 +526,8 @@ class EbuildTestCase(TestCase):
 			eapis = [random.choice(x) for x in supported_eapis]
 
 		for eapi in eapis:
-			yield cls(eapi = eapi, short_name = short_name)
+			yield cls(eapi = eapi, short_name = short_name,
+					dbus_hdlr = dbus_hdlr)
 
 	@property
 	def pn(self):
@@ -564,7 +563,7 @@ class EbuildTestCase(TestCase):
 		return '%s:%s (%s)' % (self.short_name, self.eapi,
 				self._stripped_docstring)
 
-	def __init__(self, eapi, short_name):
+	def __init__(self, eapi, *args, **kwargs):
 		"""
 		Instiantate the test case for a particular EAPI.
 
@@ -573,7 +572,7 @@ class EbuildTestCase(TestCase):
 		"""
 		self.eapi = eapi
 		self.reset()
-		TestCase.__init__(self, short_name)
+		TestCase.__init__(self, *args, **kwargs)
 
 		for v in ('ebuild_vars', 'inherits', 'phase_funcs'):
 			setattr(self, v, copy.deepcopy(getattr(self, v)))



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-01-03 15:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-31 21:06 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/, PMSTestSuite/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2011-06-03 17:36 Michał Górny
2011-06-16 19:49 Michał Górny
2011-06-16 19:49 Michał Górny
2011-06-22 13:32 Michał Górny
2011-06-29 17:52 [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/, pmstestsuite/ Michał Górny
2011-08-06 14:25 Michał Górny
2012-01-03 15:52 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox