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
=== modified file 'lib/lp/testing/__init__.py'
--- lib/lp/testing/__init__.py 2010-08-20 20:31:18 +0000
+++ lib/lp/testing/__init__.py 2010-08-24 17:14:05 +0000
@@ -50,7 +50,6 @@
50 ]50 ]
5151
52from contextlib import contextmanager52from contextlib import contextmanager
53from cStringIO import StringIO
54from datetime import (53from datetime import (
55 datetime,54 datetime,
56 timedelta,55 timedelta,
@@ -86,6 +85,8 @@
86 )85 )
87import subunit86import subunit
88import testtools87import testtools
88from testtools.content import Content
89from testtools.content_type import UTF8_TEXT
89import transaction90import transaction
90# zope.exception demands more of frame objects than twisted.python.failure91# zope.exception demands more of frame objects than twisted.python.failure
91# provides in its fake frames. This is enough to make it work with them92# provides in its fake frames. This is enough to make it work with them
@@ -392,15 +393,6 @@
392 "Expected %s to be %s, but it was %s."393 "Expected %s to be %s, but it was %s."
393 % (attribute_name, date, getattr(sql_object, attribute_name)))394 % (attribute_name, date, getattr(sql_object, attribute_name)))
394395
395 def assertEqual(self, a, b, message=''):
396 """Assert that 'a' equals 'b'."""
397 if a == b:
398 return
399 if message:
400 message += '\n'
401 self.fail("%snot equal:\na = %s\nb = %s\n"
402 % (message, pformat(a), pformat(b)))
403
404 def assertIsInstance(self, instance, assert_class):396 def assertIsInstance(self, instance, assert_class):
405 """Assert that an instance is an instance of assert_class.397 """Assert that an instance is an instance of assert_class.
406398
@@ -451,11 +443,8 @@
451443
452 def attachOopses(self):444 def attachOopses(self):
453 if len(self.oopses) > 0:445 if len(self.oopses) > 0:
454 content_type = testtools.content_type.ContentType(
455 "text", "plain", {"charset": "utf8"})
456 for (i, oops) in enumerate(self.oopses):446 for (i, oops) in enumerate(self.oopses):
457 content = testtools.content.Content(447 content = Content(UTF8_TEXT, oops.get_chunks)
458 content_type, oops.get_chunks)
459 self.addDetail("oops-%d" % i, content)448 self.addDetail("oops-%d" % i, content)
460449
461 def setUp(self):450 def setUp(self):
462451
=== modified file 'lib/lp/testing/matchers.py'
--- lib/lp/testing/matchers.py 2010-08-20 20:31:18 +0000
+++ lib/lp/testing/matchers.py 2010-08-24 17:14:05 +0000
@@ -15,7 +15,7 @@
15 ]15 ]
1616
17from testtools.content import Content17from testtools.content import Content
18from testtools.content_type import ContentType18from testtools.content_type import UTF8_TEXT
19from testtools.matchers import (19from testtools.matchers import (
20 Matcher,20 Matcher,
21 Mismatch,21 Mismatch,
@@ -137,8 +137,7 @@
137 result = []137 result = []
138 for query in self.query_collector.queries:138 for query in self.query_collector.queries:
139 result.append(unicode(query).encode('utf8'))139 result.append(unicode(query).encode('utf8'))
140 return {'queries': Content(ContentType('text', 'plain',140 return {'queries': Content(UTF8_TEXT, lambda:['\n'.join(result)])}
141 {'charset': 'utf8'}), lambda:['\n'.join(result)])}
142 141
143142
144class IsNotProxied(Mismatch):143class IsNotProxied(Mismatch):
145144
=== modified file 'versions.cfg'
--- versions.cfg 2010-08-23 14:40:19 +0000
+++ versions.cfg 2010-08-24 17:14:05 +0000
@@ -65,8 +65,7 @@
65SimpleTal = 4.165SimpleTal = 4.1
66sourcecodegen = 0.6.966sourcecodegen = 0.6.9
67storm = 0.1767storm = 0.17
68# Has the LessThan matcher.68testtools = 0.9.6
69testtools = 0.9.6dev91
70transaction = 1.0.069transaction = 1.0.0
71Twisted = 10.1.070Twisted = 10.1.0
72uuid = 1.3071uuid = 1.30