Merge lp:~jelmer/testtools/unittest2 into lp:~testtools-committers/testtools/trunk

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: 168
Proposed branch: lp:~jelmer/testtools/unittest2
Merge into: lp:~testtools-committers/testtools/trunk
Diff against target: 40 lines (+7/-0)
2 files modified
NEWS (+2/-0)
testtools/testcase.py (+5/-0)
To merge this branch: bzr merge lp:~jelmer/testtools/unittest2
Reviewer Review Type Date Requested Status
testtools developers Pending
Review via email: mp+45802@code.launchpad.net

Description of the change

This makes testtools try to use the unittest2 TestSkipped, _UnexpectedSuccess, etc classes if unittest doesn't provide them.

This should make it a bit easier to use testtools and subunit in combination with projects that support unittest2.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-12-29 18:11:12 +0000
3+++ NEWS 2011-01-11 01:08:54 +0000
4@@ -23,6 +23,8 @@
5
6 * Vastly improved and extended documentation. (Jonathan Lange)
7
8+* Use unittest2 exception classes if available. (Jelmer Vernooij)
9+
10
11 0.9.8
12 ~~~~~
13
14=== modified file 'testtools/testcase.py'
15--- testtools/testcase.py 2010-12-12 04:11:39 +0000
16+++ testtools/testcase.py 2011-01-11 01:08:54 +0000
17@@ -35,6 +35,7 @@
18
19 class TestSkipped(Exception):
20 """Raised within TestCase.run() when a test is skipped."""
21+testSkipped = try_import('unittest2.case.SkipTest', TestSkipped)
22 TestSkipped = try_import('unittest.case.SkipTest', TestSkipped)
23
24
25@@ -45,6 +46,8 @@
26 module.
27 """
28 _UnexpectedSuccess = try_import(
29+ 'unittest2.case._UnexpectedSuccess', _UnexpectedSuccess)
30+_UnexpectedSuccess = try_import(
31 'unittest.case._UnexpectedSuccess', _UnexpectedSuccess)
32
33 class _ExpectedFailure(Exception):
34@@ -54,6 +57,8 @@
35 module.
36 """
37 _ExpectedFailure = try_import(
38+ 'unittest2.case._ExpectedFailure', _ExpectedFailure)
39+_ExpectedFailure = try_import(
40 'unittest.case._ExpectedFailure', _ExpectedFailure)
41
42

Subscribers

People subscribed via source and target branches