Merge lp:~lifeless/launchpad/testtools into lp:launchpad

Proposed by Robert Collins
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: no longer in the source branch.
Merged at revision: 11915
Proposed branch: lp:~lifeless/launchpad/testtools
Merge into: lp:launchpad
Diff against target: 181 lines (+4/-77)
6 files modified
lib/canonical/launchpad/database/tests/test_stormextensions.py (+1/-1)
lib/lp/bugs/model/tests/test_bug.py (+1/-1)
lib/lp/testing/matchers.py (+0/-38)
lib/lp/testing/tests/test_factory.py (+1/-1)
lib/lp/testing/tests/test_matchers.py (+0/-35)
versions.cfg (+1/-1)
To merge this branch: bzr merge lp:~lifeless/launchpad/testtools
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+38665@code.launchpad.net

Commit message

Update to to testtools 0.9.7.

Description of the change

Update to testtools 0.9.7, this includes matchers we previously had in tree as well as supporting accurate test timings in the parallel test mode.

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) 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/canonical/launchpad/database/tests/test_stormextensions.py'
--- lib/canonical/launchpad/database/tests/test_stormextensions.py 2010-08-20 20:31:18 +0000
+++ lib/canonical/launchpad/database/tests/test_stormextensions.py 2010-10-17 18:28:07 +0000
@@ -46,7 +46,7 @@
46 case_sensitive=False)46 case_sensitive=False)
4747
48 def test_StartsWithUse(self):48 def test_StartsWithUse(self):
49 """StartWith correctly performs searches."""49 """StartsWith correctly performs searches."""
5050
51 person1 = self.factory.makePerson(name='aa', displayname="John Doe")51 person1 = self.factory.makePerson(name='aa', displayname="John Doe")
52 person2 = self.factory.makePerson(name='bb', displayname="Johan Doe")52 person2 = self.factory.makePerson(name='bb', displayname="Johan Doe")
5353
=== modified file 'lib/lp/bugs/model/tests/test_bug.py'
--- lib/lp/bugs/model/tests/test_bug.py 2010-10-15 16:11:17 +0000
+++ lib/lp/bugs/model/tests/test_bug.py 2010-10-17 18:28:07 +0000
@@ -6,6 +6,7 @@
6__metaclass__ = type6__metaclass__ = type
77
8from storm.store import ResultSet8from storm.store import ResultSet
9from testtools.matchers import StartsWith
910
10from canonical.testing.layers import DatabaseFunctionalLayer11from canonical.testing.layers import DatabaseFunctionalLayer
11from lp.bugs.mail.bugnotificationrecipients import BugNotificationRecipients12from lp.bugs.mail.bugnotificationrecipients import BugNotificationRecipients
@@ -17,7 +18,6 @@
17 person_logged_in,18 person_logged_in,
18 TestCaseWithFactory,19 TestCaseWithFactory,
19 )20 )
20from lp.testing.matchers import StartsWith
2121
2222
23class TestBug(TestCaseWithFactory):23class TestBug(TestCaseWithFactory):
2424
=== modified file 'lib/lp/testing/matchers.py'
--- lib/lp/testing/matchers.py 2010-09-19 23:52:49 +0000
+++ lib/lp/testing/matchers.py 2010-10-17 18:28:07 +0000
@@ -5,13 +5,11 @@
5__all__ = [5__all__ = [
6 'DoesNotCorrectlyProvide',6 'DoesNotCorrectlyProvide',
7 'DoesNotProvide',7 'DoesNotProvide',
8 'DoesNotStartWith',
9 'HasQueryCount',8 'HasQueryCount',
10 'IsNotProxied',9 'IsNotProxied',
11 'IsProxied',10 'IsProxied',
12 'Provides',11 'Provides',
13 'ProvidesAndIsProxied',12 'ProvidesAndIsProxied',
14 'StartsWith',
15 ]13 ]
1614
17from testtools.content import Content15from testtools.content import Content
@@ -191,42 +189,6 @@
191 return IsProxied().match(matchee)189 return IsProxied().match(matchee)
192190
193191
194class DoesNotStartWith(Mismatch):
195
196 def __init__(self, matchee, expected):
197 """Create a DoesNotStartWith Mismatch.
198
199 :param matchee: the string that did not match.
200 :param expected: the string that `matchee` was expected to start
201 with.
202 """
203 self.matchee = matchee
204 self.expected = expected
205
206 def describe(self):
207 return "'%s' does not start with '%s'." % (
208 self.matchee, self.expected)
209
210
211class StartsWith(Matcher):
212 """Checks whether one string starts with another."""
213
214 def __init__(self, expected):
215 """Create a StartsWith Matcher.
216
217 :param expected: the string that matchees should start with.
218 """
219 self.expected = expected
220
221 def __str__(self):
222 return "Starts with '%s'." % self.expected
223
224 def match(self, matchee):
225 if not matchee.startswith(self.expected):
226 return DoesNotStartWith(matchee, self.expected)
227 return None
228
229
230class IsConfiguredBatchNavigator(Matcher):192class IsConfiguredBatchNavigator(Matcher):
231 """Check that an object is a batch navigator."""193 """Check that an object is a batch navigator."""
232194
233195
=== modified file 'lib/lp/testing/tests/test_factory.py'
--- lib/lp/testing/tests/test_factory.py 2010-09-21 18:43:27 +0000
+++ lib/lp/testing/tests/test_factory.py 2010-10-17 18:28:07 +0000
@@ -9,6 +9,7 @@
9import unittest9import unittest
1010
11import pytz11import pytz
12from testtools.matchers import StartsWith
12from zope.component import getUtility13from zope.component import getUtility
13from zope.security.proxy import removeSecurityProxy14from zope.security.proxy import removeSecurityProxy
1415
@@ -58,7 +59,6 @@
58 IsProxied,59 IsProxied,
59 Provides,60 Provides,
60 ProvidesAndIsProxied,61 ProvidesAndIsProxied,
61 StartsWith,
62 )62 )
6363
6464
6565
=== modified file 'lib/lp/testing/tests/test_matchers.py'
--- lib/lp/testing/tests/test_matchers.py 2010-08-20 20:31:18 +0000
+++ lib/lp/testing/tests/test_matchers.py 2010-10-17 18:28:07 +0000
@@ -22,13 +22,11 @@
22from lp.testing.matchers import (22from lp.testing.matchers import (
23 DoesNotCorrectlyProvide,23 DoesNotCorrectlyProvide,
24 DoesNotProvide,24 DoesNotProvide,
25 DoesNotStartWith,
26 HasQueryCount,25 HasQueryCount,
27 IsNotProxied,26 IsNotProxied,
28 IsProxied,27 IsProxied,
29 Provides,28 Provides,
30 ProvidesAndIsProxied,29 ProvidesAndIsProxied,
31 StartsWith,
32 )30 )
3331
3432
@@ -224,36 +222,3 @@
224 self.assertEqual(222 self.assertEqual(
225 "queries do not match: %s" % (LessThan(2).match(2).describe(),),223 "queries do not match: %s" % (LessThan(2).match(2).describe(),),
226 mismatch.describe())224 mismatch.describe())
227
228
229class DoesNotStartWithTests(TestCase):
230
231 def test_describe(self):
232 mismatch = DoesNotStartWith("foo", "bar")
233 self.assertEqual(
234 "'foo' does not start with 'bar'.", mismatch.describe())
235
236
237class StartsWithTests(TestCase):
238
239 def test_str(self):
240 matcher = StartsWith("bar")
241 self.assertEqual("Starts with 'bar'.", str(matcher))
242
243 def test_match(self):
244 matcher = StartsWith("bar")
245 self.assertIs(None, matcher.match("barf"))
246
247 def test_mismatch_returns_does_not_start_with(self):
248 matcher = StartsWith("bar")
249 self.assertIsInstance(matcher.match("foo"), DoesNotStartWith)
250
251 def test_mismatch_sets_matchee(self):
252 matcher = StartsWith("bar")
253 mismatch = matcher.match("foo")
254 self.assertEqual("foo", mismatch.matchee)
255
256 def test_mismatch_sets_expected(self):
257 matcher = StartsWith("bar")
258 mismatch = matcher.match("foo")
259 self.assertEqual("bar", mismatch.expected)
260225
=== modified file 'versions.cfg'
--- versions.cfg 2010-10-15 04:53:38 +0000
+++ versions.cfg 2010-10-17 18:28:07 +0000
@@ -69,7 +69,7 @@
69# 0.17 plus r374 from storm trunk for fixing lp:620508 (in order to address69# 0.17 plus r374 from storm trunk for fixing lp:620508 (in order to address
70# lp:627442).70# lp:627442).
71storm = 0.17-launchpad-171storm = 0.17-launchpad-1
72testtools = 0.9.672testtools = 0.9.7
73transaction = 1.0.073transaction = 1.0.0
74Twisted = 10.1.074Twisted = 10.1.0
75uuid = 1.3075uuid = 1.30