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
1=== modified file 'lib/canonical/launchpad/database/tests/test_stormextensions.py'
2--- lib/canonical/launchpad/database/tests/test_stormextensions.py 2010-08-20 20:31:18 +0000
3+++ lib/canonical/launchpad/database/tests/test_stormextensions.py 2010-10-17 18:28:07 +0000
4@@ -46,7 +46,7 @@
5 case_sensitive=False)
6
7 def test_StartsWithUse(self):
8- """StartWith correctly performs searches."""
9+ """StartsWith correctly performs searches."""
10
11 person1 = self.factory.makePerson(name='aa', displayname="John Doe")
12 person2 = self.factory.makePerson(name='bb', displayname="Johan Doe")
13
14=== modified file 'lib/lp/bugs/model/tests/test_bug.py'
15--- lib/lp/bugs/model/tests/test_bug.py 2010-10-15 16:11:17 +0000
16+++ lib/lp/bugs/model/tests/test_bug.py 2010-10-17 18:28:07 +0000
17@@ -6,6 +6,7 @@
18 __metaclass__ = type
19
20 from storm.store import ResultSet
21+from testtools.matchers import StartsWith
22
23 from canonical.testing.layers import DatabaseFunctionalLayer
24 from lp.bugs.mail.bugnotificationrecipients import BugNotificationRecipients
25@@ -17,7 +18,6 @@
26 person_logged_in,
27 TestCaseWithFactory,
28 )
29-from lp.testing.matchers import StartsWith
30
31
32 class TestBug(TestCaseWithFactory):
33
34=== modified file 'lib/lp/testing/matchers.py'
35--- lib/lp/testing/matchers.py 2010-09-19 23:52:49 +0000
36+++ lib/lp/testing/matchers.py 2010-10-17 18:28:07 +0000
37@@ -5,13 +5,11 @@
38 __all__ = [
39 'DoesNotCorrectlyProvide',
40 'DoesNotProvide',
41- 'DoesNotStartWith',
42 'HasQueryCount',
43 'IsNotProxied',
44 'IsProxied',
45 'Provides',
46 'ProvidesAndIsProxied',
47- 'StartsWith',
48 ]
49
50 from testtools.content import Content
51@@ -191,42 +189,6 @@
52 return IsProxied().match(matchee)
53
54
55-class DoesNotStartWith(Mismatch):
56-
57- def __init__(self, matchee, expected):
58- """Create a DoesNotStartWith Mismatch.
59-
60- :param matchee: the string that did not match.
61- :param expected: the string that `matchee` was expected to start
62- with.
63- """
64- self.matchee = matchee
65- self.expected = expected
66-
67- def describe(self):
68- return "'%s' does not start with '%s'." % (
69- self.matchee, self.expected)
70-
71-
72-class StartsWith(Matcher):
73- """Checks whether one string starts with another."""
74-
75- def __init__(self, expected):
76- """Create a StartsWith Matcher.
77-
78- :param expected: the string that matchees should start with.
79- """
80- self.expected = expected
81-
82- def __str__(self):
83- return "Starts with '%s'." % self.expected
84-
85- def match(self, matchee):
86- if not matchee.startswith(self.expected):
87- return DoesNotStartWith(matchee, self.expected)
88- return None
89-
90-
91 class IsConfiguredBatchNavigator(Matcher):
92 """Check that an object is a batch navigator."""
93
94
95=== modified file 'lib/lp/testing/tests/test_factory.py'
96--- lib/lp/testing/tests/test_factory.py 2010-09-21 18:43:27 +0000
97+++ lib/lp/testing/tests/test_factory.py 2010-10-17 18:28:07 +0000
98@@ -9,6 +9,7 @@
99 import unittest
100
101 import pytz
102+from testtools.matchers import StartsWith
103 from zope.component import getUtility
104 from zope.security.proxy import removeSecurityProxy
105
106@@ -58,7 +59,6 @@
107 IsProxied,
108 Provides,
109 ProvidesAndIsProxied,
110- StartsWith,
111 )
112
113
114
115=== modified file 'lib/lp/testing/tests/test_matchers.py'
116--- lib/lp/testing/tests/test_matchers.py 2010-08-20 20:31:18 +0000
117+++ lib/lp/testing/tests/test_matchers.py 2010-10-17 18:28:07 +0000
118@@ -22,13 +22,11 @@
119 from lp.testing.matchers import (
120 DoesNotCorrectlyProvide,
121 DoesNotProvide,
122- DoesNotStartWith,
123 HasQueryCount,
124 IsNotProxied,
125 IsProxied,
126 Provides,
127 ProvidesAndIsProxied,
128- StartsWith,
129 )
130
131
132@@ -224,36 +222,3 @@
133 self.assertEqual(
134 "queries do not match: %s" % (LessThan(2).match(2).describe(),),
135 mismatch.describe())
136-
137-
138-class DoesNotStartWithTests(TestCase):
139-
140- def test_describe(self):
141- mismatch = DoesNotStartWith("foo", "bar")
142- self.assertEqual(
143- "'foo' does not start with 'bar'.", mismatch.describe())
144-
145-
146-class StartsWithTests(TestCase):
147-
148- def test_str(self):
149- matcher = StartsWith("bar")
150- self.assertEqual("Starts with 'bar'.", str(matcher))
151-
152- def test_match(self):
153- matcher = StartsWith("bar")
154- self.assertIs(None, matcher.match("barf"))
155-
156- def test_mismatch_returns_does_not_start_with(self):
157- matcher = StartsWith("bar")
158- self.assertIsInstance(matcher.match("foo"), DoesNotStartWith)
159-
160- def test_mismatch_sets_matchee(self):
161- matcher = StartsWith("bar")
162- mismatch = matcher.match("foo")
163- self.assertEqual("foo", mismatch.matchee)
164-
165- def test_mismatch_sets_expected(self):
166- matcher = StartsWith("bar")
167- mismatch = matcher.match("foo")
168- self.assertEqual("bar", mismatch.expected)
169
170=== modified file 'versions.cfg'
171--- versions.cfg 2010-10-15 04:53:38 +0000
172+++ versions.cfg 2010-10-17 18:28:07 +0000
173@@ -69,7 +69,7 @@
174 # 0.17 plus r374 from storm trunk for fixing lp:620508 (in order to address
175 # lp:627442).
176 storm = 0.17-launchpad-1
177-testtools = 0.9.6
178+testtools = 0.9.7
179 transaction = 1.0.0
180 Twisted = 10.1.0
181 uuid = 1.30