From aff764783084ed070f4d7967f85620a9f1d93c61 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Mon, 19 Oct 2009 18:40:32 +1100 Subject: Change the ExtendedToOriginal decorator to fallback xfails as success. --- python/subunit/test_results.py | 2 +- python/subunit/tests/test_test_results.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'python') 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') -- cgit v1.2.1