diff options
author | Robert Collins <robertc@robertcollins.net> | 2015-03-10 15:31:02 +1300 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2015-03-10 15:31:02 +1300 |
commit | 696416fe07f3cae1aea40fcb7b3867d858638a6c (patch) | |
tree | 252da09ce1fe6d9136aaaf826c8ec763538c342f | |
parent | 5f485b0abe6133bb0f10266bfecae632124a6a77 (diff) | |
download | testrepository-696416fe07f3cae1aea40fcb7b3867d858638a6c.tar.gz |
Fixup tests with latest testtools.
Testtools has started chunking exceptions (which is perhaps good,
perhaps bad) - but we shouldn't depend on the exact behaviour in it
for our tests.
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | testrepository/tests/test_repository.py | 14 |
2 files changed, 16 insertions, 4 deletions
@@ -5,6 +5,12 @@ testrepository release notes NEXT (In development) +++++++++++++++++++++ +CHANGES +------- + +* Isolate the testrepository test suite from the chunking (or otherwise) + behaviour of testtools' exception handlers. (Robert Collins) + 0.0.20 ++++++ diff --git a/testrepository/tests/test_repository.py b/testrepository/tests/test_repository.py index e2e5e05..4a8667b 100644 --- a/testrepository/tests/test_repository.py +++ b/testrepository/tests/test_repository.py @@ -28,6 +28,7 @@ from subunit import ( from testresources import TestResource from testtools import ( clone_test_with_new_id, + content, PlaceHolder, ) import testtools @@ -103,19 +104,24 @@ class Case(ResourcedTestCase): def passing(self): pass - def failing(self): - self.fail("oops") - def unexpected_success(self): self.expectFailure("unexpected success", self.assertTrue, True) +class FailingCase: + + def run(self, result): + result.startTest(self) + result.addError( + self, None, details={'traceback': content.text_content("")}) + result.stopTest(self) + def make_test(id, should_pass): """Make a test.""" if should_pass: case = Case("passing") else: - case = Case("failing") + case = FailingCase() return clone_test_with_new_id(case, id) |