* [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/, PMSTestSuite/library/
@ 2011-06-17 15:07 Michał Górny
0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2011-06-17 15:07 UTC (permalink / raw
To: gentoo-commits
commit: 5a594e6545b6a282749cef3915feb0522febdfda
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 17 15:07:28 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jun 17 15:07:28 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=5a594e65
Use a single list for instantiated dependant ebuilds.
---
PMSTestSuite/library/depend_case.py | 23 ++++++++++-------------
PMSTestSuite/library/standard/depend.py | 4 ++--
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/PMSTestSuite/library/depend_case.py b/PMSTestSuite/library/depend_case.py
index c7a7c56..ca111fb 100644
--- a/PMSTestSuite/library/depend_case.py
+++ b/PMSTestSuite/library/depend_case.py
@@ -25,35 +25,32 @@ class EbuildDependencyTestCase(EbuildTestCase):
def __init__(self, eapi):
EbuildTestCase.__init__(self, eapi)
- self.depend_objs = []
- self.rdepend_objs = []
+ self.dependant_ebuilds = []
- for class_list, obj_list in ((self.depend_classes, self.depend_objs),
- (self.rdepend_classes, self.rdepend_objs)):
- for d in class_list:
- obj_list.append(d(eapi))
-
- for v, obj_list in (('DEPEND', self.depend_objs),
- ('RDEPEND', self.rdepend_objs)):
+ for class_list, v in ((self.depend_classes, 'DEPEND'),
+ (self.rdepend_classes, 'RDEPEND')):
if v not in self.ebuild_vars:
self.ebuild_vars[v] = ''
- for o in obj_list:
+
+ for d in class_list:
+ o = d(eapi)
self.ebuild_vars[v] += '\n\t=%s' % o.cpv
+ self.dependant_ebuilds.append(o)
def clean(self, pm):
EbuildTestCase.clean(self, pm)
- for o in self.depend_objs + self.rdepend_objs:
+ for o in self.dependant_ebuilds:
o.clean(pm)
def get_output_files(self):
of = EbuildTestCase.get_output_files(self)
- for o in self.depend_objs + self.rdepend_objs:
+ for o in self.dependant_ebuilds:
of.update(o.get_output_files())
return of
def check_result(self, pm):
res = EbuildTestCase.check_result(self, pm)
- for o in self.depend_objs + self.rdepend_objs:
+ for o in self.dependant_ebuilds:
res &= o.check_result(pm)
return res
diff --git a/PMSTestSuite/library/standard/depend.py b/PMSTestSuite/library/standard/depend.py
index 77e2938..2c8ab01 100644
--- a/PMSTestSuite/library/standard/depend.py
+++ b/PMSTestSuite/library/standard/depend.py
@@ -14,7 +14,7 @@ class DependTest(DBusEbuildDependencyTestCase):
def __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
+ 'pms-test-suite-%s || die' % self.dependant_ebuilds[0].pv
)
class RDependTest(DBusEbuildDependencyTestCase):
@@ -26,7 +26,7 @@ class RDependTest(DBusEbuildDependencyTestCase):
def __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
+ 'pms-test-suite-%s || die' % self.dependant_ebuilds[0].pv
)
class FailingDependTest(DBusEbuildDependencyTestCase):
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/standard/, pmstestsuite/library/
@ 2011-07-18 6:32 Michał Górny
0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2011-07-18 6:32 UTC (permalink / raw
To: gentoo-commits
commit: 724d303dfb1eecab6e7a4a4d5206f51523b477f0
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 18 06:26:15 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jul 18 06:26:15 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=724d303d
Add an EclassTestCase.
---
pmstestsuite/library/case.py | 6 ++--
pmstestsuite/library/eclass_case.py | 32 ++++++++++++++++++++++++++++
pmstestsuite/library/standard/dbus_case.py | 32 ++++++++++++++++++++++++++++
3 files changed, 67 insertions(+), 3 deletions(-)
diff --git a/pmstestsuite/library/case.py b/pmstestsuite/library/case.py
index 18490ec..3f5d31e 100644
--- a/pmstestsuite/library/case.py
+++ b/pmstestsuite/library/case.py
@@ -56,7 +56,7 @@ def cleanup_test_case_name(classname):
class TestCase(ABCObject):
"""
Base class for a test case.
-
+
@ivar _finalized: has the case initialization been finished yet?
Set by L{_finalize()}.
@type _finalized: bool
@@ -121,7 +121,7 @@ class EbuildTestCase(TestCase):
The __init__() function is going to clone (deepcopy()) all the instance
variables to allow modifying them easily.
-
+
@ivar ebuild_vars: additional global variables
@type ebuild_vars: dict (string -> string)
@ivar expect_failure: if set to False (the default), the test is supposed
@@ -239,7 +239,7 @@ class EbuildTestCase(TestCase):
def __init__(self, eapi):
"""
Instiantate the test case for a particular EAPI.
-
+
@param eapi: the EAPI
@type eapi: string
"""
diff --git a/pmstestsuite/library/eclass_case.py b/pmstestsuite/library/eclass_case.py
new file mode 100644
index 0000000..864a983
--- /dev/null
+++ b/pmstestsuite/library/eclass_case.py
@@ -0,0 +1,32 @@
+# vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+from abc import abstractproperty
+
+from pmstestsuite.library.case import EbuildTestCase
+
+class EclassTestCase(EbuildTestCase):
+ """
+ Test case using an eclass (and a set of per-EAPI ebuilds).
+
+ The eclass inherit will be added to the ebuilds automatically.
+ """
+
+ @abstractproperty
+ def eclass_contents(self):
+ """
+ The eclass contents.
+
+ @type: string
+ """
+ pass
+
+ def __init__(self, eapi):
+ EbuildTestCase.__init__(self, eapi)
+ self.inherits.append(self.pn)
+
+ def get_output_files(self):
+ outf = EbuildTestCase.get_output_files(self)
+ outf['eclass/%s.eclass' % self.pn] = self.eclass_contents
+ return outf
diff --git a/pmstestsuite/library/standard/dbus_case.py b/pmstestsuite/library/standard/dbus_case.py
index 09e78eb..d8fb068 100644
--- a/pmstestsuite/library/standard/dbus_case.py
+++ b/pmstestsuite/library/standard/dbus_case.py
@@ -6,6 +6,7 @@ import dbus.service
from pmstestsuite.library.case import EbuildTestCase
from pmstestsuite.library.depend_case import EbuildDependencyTestCase
+from pmstestsuite.library.eclass_case import EclassTestCase
from pmstestsuite.dbus_handler import DBusHandler, dbus_interface_name, dbus_object_prefix
@@ -106,6 +107,37 @@ class DBusEbuildTestCase(EbuildTestCase):
return self.dbus_started \
and self.check_dbus_result('\n'.join(self.dbus_output), pm)
+class DBusEclassTestCase(EclassTestCase):
+ """ D-Bus capable eclass test case. """
+
+ inherits = ['pms-test-dbus']
+
+ 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')
+
+ 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 EbuildTestCase.check_result().
+ """
+ return EbuildTestCase.check_result(self, pm)
+
+ 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. """
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/standard/, pmstestsuite/library/
@ 2011-08-11 22:09 Michał Górny
0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2011-08-11 22:09 UTC (permalink / raw
To: gentoo-commits
commit: b52bac87315602abb8f550f5d22448ecf459724f
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 11 21:46:24 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Aug 11 21:46:24 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=b52bac87
Get dependency asserts before package ones.
That ordering seems more logical.
---
pmstestsuite/library/depend_case.py | 22 ++++++++++++++++++++--
pmstestsuite/library/standard/dbus_case.py | 8 ++++----
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/pmstestsuite/library/depend_case.py b/pmstestsuite/library/depend_case.py
index 55e49cc..0d4f8e7 100644
--- a/pmstestsuite/library/depend_case.py
+++ b/pmstestsuite/library/depend_case.py
@@ -118,8 +118,17 @@ class EbuildDependencyTestCase(BaseDependencyTestCase, EbuildTestCase):
return of
def check_result(self, pm):
+ try:
+ BaseDependencyTestCase.check_result(self, pm)
+ except AssertionError as e:
+ exc = e
+ else:
+ exc = None
+
EbuildTestCase.check_result(self, pm)
- BaseDependencyTestCase.check_result(self, pm)
+
+ if exc is not None:
+ raise exc
class EclassDependencyTestCase(BaseDependencyTestCase, EclassTestCase):
"""
@@ -180,5 +189,14 @@ class EclassDependencyTestCase(BaseDependencyTestCase, EclassTestCase):
return of
def check_result(self, pm):
+ try:
+ BaseDependencyTestCase.check_result(self, pm)
+ except AssertionError as e:
+ exc = e
+ else:
+ exc = None
+
EclassTestCase.check_result(self, pm)
- BaseDependencyTestCase.check_result(self, pm)
+
+ if exc is not None:
+ raise exc
diff --git a/pmstestsuite/library/standard/dbus_case.py b/pmstestsuite/library/standard/dbus_case.py
index 7d1b46f..a76bba4 100644
--- a/pmstestsuite/library/standard/dbus_case.py
+++ b/pmstestsuite/library/standard/dbus_case.py
@@ -151,9 +151,9 @@ class DBusEbuildDependencyTestCase(DBusBaseTestCase, EbuildDependencyTestCase):
EbuildDependencyTestCase.check_result(self, pm)
def check_result(self, pm):
- self.assertBool(not self.expect_failure, self.dbus_started,
- 'build started')
+ started = self.dbus_started
self.check_dbus_result(self._pop_dbus_output(), pm)
+ self.assertBool(not self.expect_failure, started, 'build started')
class DBusEclassDependencyTestCase(DBusBaseTestCase, EclassDependencyTestCase):
""" D-Bus capable eclass dependency test case. """
@@ -167,6 +167,6 @@ class DBusEclassDependencyTestCase(DBusBaseTestCase, EclassDependencyTestCase):
EclassDependencyTestCase.check_result(self, pm)
def check_result(self, pm):
- self.assertBool(not self.expect_failure, self.dbus_started,
- 'build started')
+ started = self.dbus_started
self.check_dbus_result(self._pop_dbus_output(), pm)
+ self.assertBool(not self.expect_failure, started, 'build started')
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/standard/, pmstestsuite/library/
@ 2012-01-02 22:03 Michał Górny
0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2012-01-02 22:03 UTC (permalink / raw
To: gentoo-commits
commit: 6f58b9a9bc5a1e7314336caec10acabe751d1f94
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 2 21:29:24 2012 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jan 2 21:29:24 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=6f58b9a9
Integrate the D-Bus object with base D-Bus test case class.
---
pmstestsuite/library/case.py | 4 +-
pmstestsuite/library/standard/dbus_case.py | 32 +++++++++------------------
2 files changed, 13 insertions(+), 23 deletions(-)
diff --git a/pmstestsuite/library/case.py b/pmstestsuite/library/case.py
index a5817fb..614a500 100644
--- a/pmstestsuite/library/case.py
+++ b/pmstestsuite/library/case.py
@@ -1,5 +1,5 @@
# vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.
import copy, itertools, random, re
@@ -227,7 +227,7 @@ class NotEqualAssertionResult(EqualAssertionResult):
return '%s != %s' % (self.actual,
repr(self._expect))
-class TestCase(ABCObject):
+class TestCase(object): # was: ABCObject
"""
Base class for a test case.
diff --git a/pmstestsuite/library/standard/dbus_case.py b/pmstestsuite/library/standard/dbus_case.py
index 672ace5..ac9c4d1 100644
--- a/pmstestsuite/library/standard/dbus_case.py
+++ b/pmstestsuite/library/standard/dbus_case.py
@@ -1,5 +1,5 @@
# vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.
import dbus.service
@@ -13,30 +13,26 @@ from pmstestsuite.dbus_handler import DBusHandler, dbus_interface_name, dbus_obj
dbus_handler = DBusHandler()
-class RunningTest(dbus.service.Object):
- """ A class encapsulating a running test. """
+class DBusBaseTestCase(dbus.service.Object):
+ """ A base D-Bus test case class. """
- def __init__(self, test):
+ def __init__(self):
"""
- Initialize the D-Bus object for the test.
-
- @param test: the test
- @type test: L{TestCase}
+ Initialize the D-Bus interface for the test.
"""
- self.test = test
self.reset()
dbus.service.Object.__init__(
self,
dbus_handler.bus,
- '%s/%s' % (dbus_object_prefix, test.p.replace('-', '_'))
+ '%s/%s' % (dbus_object_prefix, self.p.replace('-', '_'))
)
def reset(self):
"""
Reset test results.
"""
- self.test.dbus_output = []
- self.test.dbus_started = False
+ self.dbus_output = []
+ self.dbus_started = False
@dbus.service.method(
dbus_interface=dbus_interface_name,
@@ -45,7 +41,7 @@ class RunningTest(dbus.service.Object):
"""
Notify the test suite that a particular test has been started.
"""
- self.test.dbus_started = True
+ self.dbus_started = True
@dbus.service.method(
dbus_interface=dbus_interface_name,
@@ -57,13 +53,7 @@ class RunningTest(dbus.service.Object):
@param l: result string
@type l: C{dbus.UTF8String}
"""
- self.test.dbus_output.append(str(l))
-
-class DBusBaseTestCase(object):
- """ A base D-Bus test case class. """
-
- def __init__(self):
- self._dbusobj = RunningTest(self)
+ self.dbus_output.append(str(l))
def _finalize(self):
"""
@@ -92,7 +82,7 @@ class DBusBaseTestCase(object):
def _pop_dbus_output(self):
ret = self.dbus_output
- self._dbusobj.reset()
+ self.reset()
return ret
def check_result(self, pm):
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/standard/, pmstestsuite/library/
@ 2012-01-02 22:26 Michał Górny
0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2012-01-02 22:26 UTC (permalink / raw
To: gentoo-commits
commit: 948bbafc0f1a2c2eeb524cca38ac98ea966bb475
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 2 22:11:11 2012 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jan 2 22:13:22 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=948bbafc
Merge D-Bus into main case classes.
---
pmstestsuite/library/case.py | 78 +++++++++++++++-
pmstestsuite/library/depend_case.py | 2 +-
pmstestsuite/library/eclass_case.py | 2 +-
pmstestsuite/library/standard/dbus_case.py | 140 ++--------------------------
4 files changed, 86 insertions(+), 136 deletions(-)
diff --git a/pmstestsuite/library/case.py b/pmstestsuite/library/case.py
index 614a500..90406a0 100644
--- a/pmstestsuite/library/case.py
+++ b/pmstestsuite/library/case.py
@@ -5,8 +5,14 @@
import copy, itertools, random, re
from gentoopm.util import ABCObject, BoolCompat
+import dbus.service
+
from abc import ABCMeta, abstractmethod, abstractproperty
+from pmstestsuite.dbus_handler import DBusHandler, dbus_interface_name, dbus_object_prefix
+
+dbus_handler = DBusHandler()
+
# XXX: move to some consts module?
phase_func_names = [
'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
@@ -227,7 +233,7 @@ class NotEqualAssertionResult(EqualAssertionResult):
return '%s != %s' % (self.actual,
repr(self._expect))
-class TestCase(object): # was: ABCObject
+class TestCase(dbus.service.Object): # was: ABCObject
"""
Base class for a test case.
@@ -239,9 +245,19 @@ class TestCase(object): # was: ABCObject
_finalized = False
def __init__(self, short_name):
+ """
+ Initialize the test class and the D-Bus interface for it.
+ """
+
self.assertions = []
self._short_name = short_name
+ dbus.service.Object.__init__(
+ self,
+ dbus_handler.bus,
+ '%s/%s' % (dbus_object_prefix, self.p.replace('-', '_'))
+ )
+
@property
def short_name(self):
return self._short_name
@@ -258,6 +274,8 @@ class TestCase(object): # was: ABCObject
def _finalize(self):
"""
Do any final modifications to test case data. Mark it finalized.
+ Ensure that C{pkg_setup()} will be called.
+
This function shall be called at most once per object.
"""
self._finalized = True
@@ -531,6 +549,8 @@ class EbuildTestCase(TestCase):
def _finalize(self):
TestCase._finalize(self)
+ if self.phase_funcs['pkg_setup']:
+ self.phase_funcs['pkg_setup'].insert(0, 'pms-test_pkg_setup')
if 'DESCRIPTION' not in self.ebuild_vars:
self.ebuild_vars['DESCRIPTION'] = self._stripped_docstring
@@ -546,8 +566,9 @@ class EbuildTestCase(TestCase):
@param eapi: the EAPI
@type eapi: string
"""
- TestCase.__init__(self, short_name)
self.eapi = eapi
+ self.reset()
+ TestCase.__init__(self, short_name)
for v in ('ebuild_vars', 'inherits', 'phase_funcs'):
setattr(self, v, copy.deepcopy(getattr(self, v)))
@@ -559,6 +580,34 @@ class EbuildTestCase(TestCase):
self.ebuild_vars['KEYWORDS'] = 'alpha amd64 arm hppa ia64 ' + \
'm68k ~mips ppc ppc64 s390 sh sparc x86'
+ def reset(self):
+ """
+ Reset (D-Bus) test results.
+ """
+ self.dbus_output = []
+ self.dbus_started = False
+
+ @dbus.service.method(
+ dbus_interface=dbus_interface_name,
+ in_signature='', out_signature='')
+ def test_started(self):
+ """
+ Notify the test suite that a particular test has been started.
+ """
+ self.dbus_started = True
+
+ @dbus.service.method(
+ dbus_interface=dbus_interface_name,
+ in_signature='s', out_signature='')
+ def append_output(self, l):
+ """
+ Append the string to the test output.
+
+ @param l: result string
+ @type l: C{dbus.UTF8String}
+ """
+ self.dbus_output.append(str(l))
+
def get_output_files(self):
class EbuildTestCaseEbuildFile(object):
""" Lazy ebuild contents evaluator for EbuildTestCase. """
@@ -610,6 +659,29 @@ class EbuildTestCase(TestCase):
def start(self, pm):
pm.merge(self.cpv)
+ def check_dbus_result(self, output, pm):
+ """
+ Check whether the output sent through D-Bus matches expected test
+ output.
+
+ The default implementation simply checks whether the test was merged
+ alike L{EbuildTestCase.check_result()}.
+
+ @param output: the D-Bus output
+ @type output: list(str)
+ @param pm: the package manager instance
+ @type pm: L{PackageManager}
+ @return: C{True} if output matches expected test result, C{False}
+ otherwise
+ @rtype: bool
+ """
+ pass
+
+ def _pop_dbus_output(self):
+ ret = self.dbus_output
+ self.reset()
+ return ret
+
def check_result(self, pm):
"""
Check the correctness of the result of test execution. By default,
@@ -622,3 +694,5 @@ class EbuildTestCase(TestCase):
merged = self.atom(pm) in pm.installed
self.assertBool(not self.expect_failure, merged,
'package merged')
+ self.assertTrue(self.dbus_started, 'build started')
+ self.check_dbus_result(self._pop_dbus_output(), pm)
diff --git a/pmstestsuite/library/depend_case.py b/pmstestsuite/library/depend_case.py
index bc06aa3..3f34ca7 100644
--- a/pmstestsuite/library/depend_case.py
+++ b/pmstestsuite/library/depend_case.py
@@ -1,5 +1,5 @@
# vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.
from .case import EbuildTestCase, AssertionResult
diff --git a/pmstestsuite/library/eclass_case.py b/pmstestsuite/library/eclass_case.py
index cd64a9a..d409e0d 100644
--- a/pmstestsuite/library/eclass_case.py
+++ b/pmstestsuite/library/eclass_case.py
@@ -1,5 +1,5 @@
# vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.
from abc import abstractproperty
diff --git a/pmstestsuite/library/standard/dbus_case.py b/pmstestsuite/library/standard/dbus_case.py
index ac9c4d1..14258b7 100644
--- a/pmstestsuite/library/standard/dbus_case.py
+++ b/pmstestsuite/library/standard/dbus_case.py
@@ -2,143 +2,19 @@
# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.
-import dbus.service
-
from pmstestsuite.library.case import EbuildTestCase
from pmstestsuite.library.depend_case import EbuildDependencyTestCase, \
EclassDependencyTestCase
from pmstestsuite.library.eclass_case import EclassTestCase
-from pmstestsuite.dbus_handler import DBusHandler, dbus_interface_name, dbus_object_prefix
-
-dbus_handler = DBusHandler()
-
-class DBusBaseTestCase(dbus.service.Object):
- """ A base D-Bus test case class. """
-
- def __init__(self):
- """
- Initialize the D-Bus interface for the test.
- """
- self.reset()
- dbus.service.Object.__init__(
- self,
- dbus_handler.bus,
- '%s/%s' % (dbus_object_prefix, self.p.replace('-', '_'))
- )
-
- def reset(self):
- """
- Reset test results.
- """
- self.dbus_output = []
- self.dbus_started = False
-
- @dbus.service.method(
- dbus_interface=dbus_interface_name,
- in_signature='', out_signature='')
- def test_started(self):
- """
- Notify the test suite that a particular test has been started.
- """
- self.dbus_started = True
-
- @dbus.service.method(
- dbus_interface=dbus_interface_name,
- in_signature='s', out_signature='')
- def append_output(self, l):
- """
- Append the string to the test output.
-
- @param l: result string
- @type l: C{dbus.UTF8String}
- """
- self.dbus_output.append(str(l))
-
- def _finalize(self):
- """
- Finalize the object, ensuring that C{pkg_setup()} will be called.
- """
- if self.phase_funcs['pkg_setup']:
- self.phase_funcs['pkg_setup'].insert(0, 'pms-test_pkg_setup')
-
- def check_dbus_result(self, output, pm):
- """
- Check whether the output sent through D-Bus matches expected test
- output.
-
- The default implementation simply checks whether the test was merged
- alike L{EbuildTestCase.check_result()}.
-
- @param output: the D-Bus output
- @type output: list(str)
- @param pm: the package manager instance
- @type pm: L{PackageManager}
- @return: C{True} if output matches expected test result, C{False}
- otherwise
- @rtype: bool
- """
- pass
-
- def _pop_dbus_output(self):
- ret = self.dbus_output
- self.reset()
- return ret
-
- def check_result(self, pm):
- self.assertTrue(self.dbus_started, 'build started')
- self.check_dbus_result(self._pop_dbus_output(), pm)
-
-class DBusEbuildTestCase(DBusBaseTestCase, EbuildTestCase):
- """ D-Bus capable ebuild test case. """
-
- def __init__(self, *args, **kwargs):
- """ Initialize the test case and the D-Bus object for it. """
- EbuildTestCase.__init__(self, *args, **kwargs)
- DBusBaseTestCase.__init__(self)
-
- def check_dbus_result(self, output, pm):
- EbuildTestCase.check_result(self, pm)
-
-class DBusEclassTestCase(DBusBaseTestCase, EclassTestCase):
- """ D-Bus capable eclass test case. """
-
- 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_dbus_result(self, output, pm):
- EclassTestCase.check_result(self, pm)
-
-class DBusEbuildDependencyTestCase(DBusBaseTestCase, EbuildDependencyTestCase):
- """ D-Bus capable dependency test case. """
-
- def __init__(self, *args, **kwargs):
- """ Initialize the test case and the D-Bus object for it. """
- EbuildDependencyTestCase.__init__(self, *args, **kwargs)
- DBusBaseTestCase.__init__(self)
-
- def check_dbus_result(self, output, pm):
- EbuildDependencyTestCase.check_result(self, pm)
-
- def check_result(self, pm):
- started = self.dbus_started
- self.check_dbus_result(self._pop_dbus_output(), pm)
- self.assertBool(not self.expect_failure, started, 'build started')
-
-class DBusEclassDependencyTestCase(DBusBaseTestCase, EclassDependencyTestCase):
- """ D-Bus capable eclass dependency test case. """
+class DBusEbuildTestCase(EbuildTestCase):
+ pass
- def __init__(self, *args, **kwargs):
- """ Initialize the test case and the D-Bus object for it. """
- EclassDependencyTestCase.__init__(self, *args, **kwargs)
- DBusBaseTestCase.__init__(self)
+class DBusEclassTestCase(EclassTestCase):
+ pass
- def check_dbus_result(self, output, pm):
- EclassDependencyTestCase.check_result(self, pm)
+class DBusEbuildDependencyTestCase(EbuildDependencyTestCase):
+ pass
- def check_result(self, pm):
- started = self.dbus_started
- self.check_dbus_result(self._pop_dbus_output(), pm)
- self.assertBool(not self.expect_failure, started, 'build started')
+class DBusEclassDependencyTestCase(EclassDependencyTestCase):
+ pass
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-01-02 22:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-18 6:32 [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/standard/, pmstestsuite/library/ Michał Górny
-- strict thread matches above, loose matches on Subject: below --
2012-01-02 22:26 Michał Górny
2012-01-02 22:03 Michał Górny
2011-08-11 22:09 Michał Górny
2011-06-17 15:07 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/, PMSTestSuite/library/ 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