summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2009-10-19 18:40:32 +1100
committerRobert Collins <robertc@robertcollins.net>2009-10-19 18:40:32 +1100
commitaff764783084ed070f4d7967f85620a9f1d93c61 (patch)
treeb0ec2fa8ef3d624c39ff100d9e23cb4ccb294f84 /python
parentb0a8bdf6461efd429e86b61f21783174fa060422 (diff)
downloadsubunit-git-aff764783084ed070f4d7967f85620a9f1d93c61.tar.gz
Change the ExtendedToOriginal decorator to fallback xfails as success.
Diffstat (limited to 'python')
-rw-r--r--python/subunit/test_results.py2
-rw-r--r--python/subunit/tests/test_test_results.py14
2 files changed, 13 insertions, 3 deletions
diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py
index 7ec85fe..66bb403 100644
--- a/python/subunit/test_results.py
+++ b/python/subunit/test_results.py
@@ -247,7 +247,7 @@ class ExtendedToOriginalDecorator(object):
self._check_args(err, details)
addExpectedFailure = getattr(self.decorated, 'addExpectedFailure', None)
if addExpectedFailure is None:
- addExpectedFailure = self.decorated.addFailure
+ return self.addSuccess(test)
if details is not None:
try:
return addExpectedFailure(test, details=details)
diff --git a/python/subunit/tests/test_test_results.py b/python/subunit/tests/test_test_results.py
index 7a9d4e6..bdb603f 100644
--- a/python/subunit/tests/test_test_results.py
+++ b/python/subunit/tests/test_test_results.py
@@ -206,6 +206,16 @@ class TestExtendedToOriginalResultDecoratorBase(unittest.TestCase):
getattr(self.converter, outcome)(self, err)
self.assertEqual([(expected, self, err)], self.result._calls)
+ def check_outcome_exc_info_to_nothing(self, outcome, expected=None):
+ """Check that calling a legacy outcome on a fallback works."""
+ # calling some outcome with the legacy exc_info style api (no keyword
+ # parameters) gets passed through.
+ if not expected:
+ expected = outcome
+ err = subunit.RemoteError("foo\nbar\n")
+ getattr(self.converter, outcome)(self, err)
+ self.assertEqual([(expected, self)], self.result._calls)
+
def check_outcome_nothing(self, outcome, expected=None):
"""Check that calling a legacy outcome still works."""
if not expected:
@@ -335,11 +345,11 @@ class TestExtendedToOriginalAddExpectedFailure(
def test_outcome_Original_py26(self):
self.make_26_result()
- self.check_outcome_exc_info(self.outcome, 'addFailure')
+ self.check_outcome_exc_info_to_nothing(self.outcome, 'addSuccess')
def test_outcome_Extended_py26(self):
self.make_26_result()
- self.check_outcome_details_to_exec_info(self.outcome, 'addFailure')
+ self.check_outcome_details_to_nothing(self.outcome, 'addSuccess')