diff options
author | 2011-08-11 23:38:42 +0200 | |
---|---|---|
committer | 2011-08-11 23:38:42 +0200 | |
commit | 07fb0188ef5b99c66b416953223d16a12e792f68 (patch) | |
tree | 7995565c5e7e85d745764e8aa342a02690d8b1e2 | |
parent | Support passing random args to EclassTestCase(). (diff) | |
download | pms-test-suite-07fb0188ef5b99c66b416953223d16a12e792f68.tar.gz pms-test-suite-07fb0188ef5b99c66b416953223d16a12e792f68.tar.bz2 pms-test-suite-07fb0188ef5b99c66b416953223d16a12e792f68.zip |
Prefix dep assertions and add them to assert list.
-rw-r--r-- | pmstestsuite/library/depend_case.py | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/pmstestsuite/library/depend_case.py b/pmstestsuite/library/depend_case.py index 1185a16..55e49cc 100644 --- a/pmstestsuite/library/depend_case.py +++ b/pmstestsuite/library/depend_case.py @@ -2,9 +2,44 @@ # (c) 2011 Michał Górny <mgorny@gentoo.org> # Released under the terms of the 2-clause BSD license. -from pmstestsuite.library.case import EbuildTestCase +from pmstestsuite.library.case import EbuildTestCase, AssertionResult from pmstestsuite.library.eclass_case import EclassTestCase +class DepWrappedAssertion(AssertionResult): + def __init__(self, assertion, prefix): + self._assert = assertion + self._prefix = prefix + + @property + def name(self): + return '[%s] %s' % (self._prefix, self._assert.name) + + @property + def prefix(self): + return self._prefix + + @property + def unprefixed_name(self): + return self._assert.name + + @property + def undefined(self): + return self._assert.undefined + + @property + def expected(self): + return self._assert.expected + + @property + def actual(self): + return self._assert.actual + + def __bool__(self): + return bool(self._assert) + + def __str__(self): + return str(self._assert) + class BaseDependencyTestCase(object): """ @cvar depend_classes: classes for C{DEPEND} generation @@ -33,8 +68,9 @@ class BaseDependencyTestCase(object): if v not in self.ebuild_vars: self.ebuild_vars[v] = '' - for d in class_list: + for i, d in enumerate(class_list): o = d(*args, **kwargs) + o._dep_prefix = '%s %d' % (v[:-3], i) self.ebuild_vars[v] += '\n\t=%s' % o.cpv self.dependant_ebuilds.append(o) @@ -49,6 +85,8 @@ class BaseDependencyTestCase(object): def check_result(self, pm): for o in self.dependant_ebuilds: o.check_result(pm) + self.assertions.extend([DepWrappedAssertion(x, o._dep_prefix) + for x in o.assertions]) class EbuildDependencyTestCase(BaseDependencyTestCase, EbuildTestCase): """ @@ -124,8 +162,9 @@ class EclassDependencyTestCase(BaseDependencyTestCase, EclassTestCase): (self.eclass_pdepend_classes, 'PDEPEND')): ev = '' - for d in class_list: + for i, d in enumerate(class_list): o = d(*args, **kwargs) + o._dep_prefix = 'eclass %s %d' % (v[:-3], i) ev += '\n\t=%s' % o.cpv self.dependant_ebuilds.append(o) self.eclass_contents = '%s="%s"\n%s' % (v, ev, |