Merge lp:~jml/launchpad/testtools-0.9.6 into lp:launchpad

Proposed by Jonathan Lange
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 11436
Proposed branch: lp:~jml/launchpad/testtools-0.9.6
Merge into: lp:launchpad
Diff against target: 86 lines (+6/-19)
3 files modified
lib/lp/testing/__init__.py (+3/-14)
lib/lp/testing/matchers.py (+2/-3)
versions.cfg (+1/-2)
To merge this branch: bzr merge lp:~jml/launchpad/testtools-0.9.6
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+33556@code.launchpad.net

Commit message

Upgrade to testtools 0.9.6.

Description of the change

This branch upgrades the version of testtools that we are using to an actual released version, 0.9.6.

The new version of testtools has a very similar version of assertEqual, so we no longer need to define our own.

Also, testtools now has a UTF8_TEXT built-in ContentType (since every single use of addDetail that I've seen uses it). This branch makes our test infrastructure use that.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/testing/__init__.py'
2--- lib/lp/testing/__init__.py 2010-08-20 20:31:18 +0000
3+++ lib/lp/testing/__init__.py 2010-08-24 17:14:05 +0000
4@@ -50,7 +50,6 @@
5 ]
6
7 from contextlib import contextmanager
8-from cStringIO import StringIO
9 from datetime import (
10 datetime,
11 timedelta,
12@@ -86,6 +85,8 @@
13 )
14 import subunit
15 import testtools
16+from testtools.content import Content
17+from testtools.content_type import UTF8_TEXT
18 import transaction
19 # zope.exception demands more of frame objects than twisted.python.failure
20 # provides in its fake frames. This is enough to make it work with them
21@@ -392,15 +393,6 @@
22 "Expected %s to be %s, but it was %s."
23 % (attribute_name, date, getattr(sql_object, attribute_name)))
24
25- def assertEqual(self, a, b, message=''):
26- """Assert that 'a' equals 'b'."""
27- if a == b:
28- return
29- if message:
30- message += '\n'
31- self.fail("%snot equal:\na = %s\nb = %s\n"
32- % (message, pformat(a), pformat(b)))
33-
34 def assertIsInstance(self, instance, assert_class):
35 """Assert that an instance is an instance of assert_class.
36
37@@ -451,11 +443,8 @@
38
39 def attachOopses(self):
40 if len(self.oopses) > 0:
41- content_type = testtools.content_type.ContentType(
42- "text", "plain", {"charset": "utf8"})
43 for (i, oops) in enumerate(self.oopses):
44- content = testtools.content.Content(
45- content_type, oops.get_chunks)
46+ content = Content(UTF8_TEXT, oops.get_chunks)
47 self.addDetail("oops-%d" % i, content)
48
49 def setUp(self):
50
51=== modified file 'lib/lp/testing/matchers.py'
52--- lib/lp/testing/matchers.py 2010-08-20 20:31:18 +0000
53+++ lib/lp/testing/matchers.py 2010-08-24 17:14:05 +0000
54@@ -15,7 +15,7 @@
55 ]
56
57 from testtools.content import Content
58-from testtools.content_type import ContentType
59+from testtools.content_type import UTF8_TEXT
60 from testtools.matchers import (
61 Matcher,
62 Mismatch,
63@@ -137,8 +137,7 @@
64 result = []
65 for query in self.query_collector.queries:
66 result.append(unicode(query).encode('utf8'))
67- return {'queries': Content(ContentType('text', 'plain',
68- {'charset': 'utf8'}), lambda:['\n'.join(result)])}
69+ return {'queries': Content(UTF8_TEXT, lambda:['\n'.join(result)])}
70
71
72 class IsNotProxied(Mismatch):
73
74=== modified file 'versions.cfg'
75--- versions.cfg 2010-08-23 14:40:19 +0000
76+++ versions.cfg 2010-08-24 17:14:05 +0000
77@@ -65,8 +65,7 @@
78 SimpleTal = 4.1
79 sourcecodegen = 0.6.9
80 storm = 0.17
81-# Has the LessThan matcher.
82-testtools = 0.9.6dev91
83+testtools = 0.9.6
84 transaction = 1.0.0
85 Twisted = 10.1.0
86 uuid = 1.30