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

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 11915
Proposed branch: lp:~mwhudson/launchpad/testtools
Merge into: lp:launchpad
Prerequisite: lp:~lifeless/launchpad/testtools
Diff against target: 208 lines (+7/-96)
7 files modified
lib/canonical/launchpad/ftests/test_wadl_generation.py (+3/-4)
lib/lp/bugs/model/tests/test_bug.py (+0/-6)
lib/lp/code/model/branchjob.py (+1/-0)
lib/lp/code/model/tests/test_branchpuller.py (+3/-3)
lib/lp/testing/matchers.py (+0/-39)
lib/lp/testing/tests/test_matchers.py (+0/-36)
versions.cfg (+0/-8)
To merge this branch: bzr merge lp:~mwhudson/launchpad/testtools
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+38896@code.launchpad.net

Commit message

[r=lifeless][ui=none][no-qa] Remove StartsWith matcher from lp.testing.matchers in favour of one from testtools & fix some assertions that always passed.

Description of the change

I fixed some fallout from the prerequisite branch.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/canonical/launchpad/ftests/test_wadl_generation.py'
--- lib/canonical/launchpad/ftests/test_wadl_generation.py 2010-10-01 19:30:55 +0000
+++ lib/canonical/launchpad/ftests/test_wadl_generation.py 2010-11-12 00:45:16 +0000
@@ -10,6 +10,8 @@
10import subprocess10import subprocess
11import tempfile11import tempfile
1212
13from testtools.matchers import StartsWith
14
13from zope.component import getUtility15from zope.component import getUtility
1416
15from canonical.launchpad.rest.wadl import generate_wadl, generate_html17from canonical.launchpad.rest.wadl import generate_wadl, generate_html
@@ -17,10 +19,7 @@
17from canonical.testing import LaunchpadFunctionalLayer19from canonical.testing import LaunchpadFunctionalLayer
18from lazr.restful.interfaces import IWebServiceConfiguration20from lazr.restful.interfaces import IWebServiceConfiguration
19from lp.testing import TestCase21from lp.testing import TestCase
20from lp.testing.matchers import (22from lp.testing.matchers import Contains
21 Contains,
22 StartsWith,
23 )
2423
2524
26class SmokeTestWadlAndDocGeneration(TestCase):25class SmokeTestWadlAndDocGeneration(TestCase):
2726
=== modified file 'lib/lp/bugs/model/tests/test_bug.py'
--- lib/lp/bugs/model/tests/test_bug.py 2010-11-12 00:45:09 +0000
+++ lib/lp/bugs/model/tests/test_bug.py 2010-10-26 15:47:24 +0000
@@ -3,12 +3,6 @@
33
4__metaclass__ = type4__metaclass__ = type
55
6<<<<<<< TREE
7=======
8from storm.store import ResultSet
9from testtools.matchers import StartsWith
10
11>>>>>>> MERGE-SOURCE
12from canonical.testing.layers import DatabaseFunctionalLayer6from canonical.testing.layers import DatabaseFunctionalLayer
13from lp.registry.enum import BugNotificationLevel7from lp.registry.enum import BugNotificationLevel
14from lp.registry.interfaces.person import PersonVisibility8from lp.registry.interfaces.person import PersonVisibility
159
=== modified file 'lib/lp/code/model/branchjob.py'
--- lib/lp/code/model/branchjob.py 2010-11-07 12:17:44 +0000
+++ lib/lp/code/model/branchjob.py 2010-11-12 00:45:16 +0000
@@ -54,6 +54,7 @@
54 classProvides,54 classProvides,
55 implements,55 implements,
56 )56 )
57from zope.security.proxy import removeSecurityProxy
5758
58from canonical.config import config59from canonical.config import config
59from canonical.database.enumcol import EnumCol60from canonical.database.enumcol import EnumCol
6061
=== modified file 'lib/lp/code/model/tests/test_branchpuller.py'
--- lib/lp/code/model/tests/test_branchpuller.py 2010-11-08 13:50:40 +0000
+++ lib/lp/code/model/tests/test_branchpuller.py 2010-11-12 00:45:16 +0000
@@ -61,7 +61,7 @@
61 """requestMirror sets the mirror request time to 'now'."""61 """requestMirror sets the mirror request time to 'now'."""
62 branch = self.makeAnyBranch()62 branch = self.makeAnyBranch()
63 branch.requestMirror()63 branch.requestMirror()
64 self.assertEqual(branch.next_mirror_time, UTC_NOW)64 self.assertSqlAttributeEqualsDate(branch, 'next_mirror_time', UTC_NOW)
6565
66 def test_requestMirror_doesnt_demote_branch(self):66 def test_requestMirror_doesnt_demote_branch(self):
67 # requestMirror() sets the mirror request time to 'now' unless67 # requestMirror() sets the mirror request time to 'now' unless
@@ -78,10 +78,10 @@
78 # requestMirror() sets the mirror request time to 'now' if78 # requestMirror() sets the mirror request time to 'now' if
79 # next_mirror_time is set and in the future.79 # next_mirror_time is set and in the future.
80 branch = self.makeAnyBranch()80 branch = self.makeAnyBranch()
81 future_time = datetime.now(pytz.UTC) - timedelta(days=1)81 future_time = datetime.now(pytz.UTC) + timedelta(days=1)
82 removeSecurityProxy(branch).next_mirror_time = future_time82 removeSecurityProxy(branch).next_mirror_time = future_time
83 branch.requestMirror()83 branch.requestMirror()
84 self.assertEqual(branch.next_mirror_time, UTC_NOW)84 self.assertSqlAttributeEqualsDate(branch, 'next_mirror_time', UTC_NOW)
8585
86 def test_mirroringResetsMirrorRequest(self):86 def test_mirroringResetsMirrorRequest(self):
87 """Mirroring branches resets their mirror request times."""87 """Mirroring branches resets their mirror request times."""
8888
=== modified file 'lib/lp/testing/matchers.py'
--- lib/lp/testing/matchers.py 2010-11-12 00:45:09 +0000
+++ lib/lp/testing/matchers.py 2010-11-12 00:45:16 +0000
@@ -189,43 +189,6 @@
189 return IsProxied().match(matchee)189 return IsProxied().match(matchee)
190190
191191
192<<<<<<< TREE
193class DoesNotStartWith(Mismatch):
194
195 def __init__(self, matchee, expected):
196 """Create a DoesNotStartWith Mismatch.
197
198 :param matchee: the string that did not match.
199 :param expected: the string that `matchee` was expected to start
200 with.
201 """
202 self.matchee = matchee
203 self.expected = expected
204
205 def describe(self):
206 return "'%s' does not start with '%s'." % (
207 self.matchee, self.expected)
208
209
210class StartsWith(Matcher):
211 """Checks whether one string starts with another."""
212
213 def __init__(self, expected):
214 """Create a StartsWith Matcher.
215
216 :param expected: the string that matchees should start with.
217 """
218 self.expected = expected
219
220 def __str__(self):
221 return "Starts with '%s'." % self.expected
222
223 def match(self, matchee):
224 if not matchee.startswith(self.expected):
225 return DoesNotStartWith(matchee, self.expected)
226 return None
227
228
229class DoesNotContain(Mismatch):192class DoesNotContain(Mismatch):
230193
231 def __init__(self, matchee, expected):194 def __init__(self, matchee, expected):
@@ -261,8 +224,6 @@
261 return None224 return None
262225
263226
264=======
265>>>>>>> MERGE-SOURCE
266class IsConfiguredBatchNavigator(Matcher):227class IsConfiguredBatchNavigator(Matcher):
267 """Check that an object is a batch navigator."""228 """Check that an object is a batch navigator."""
268229
269230
=== modified file 'lib/lp/testing/tests/test_matchers.py'
--- lib/lp/testing/tests/test_matchers.py 2010-11-12 00:45:09 +0000
+++ lib/lp/testing/tests/test_matchers.py 2010-11-12 00:45:16 +0000
@@ -224,40 +224,6 @@
224 self.assertEqual(224 self.assertEqual(
225 "queries do not match: %s" % (LessThan(2).match(2).describe(),),225 "queries do not match: %s" % (LessThan(2).match(2).describe(),),
226 mismatch.describe())226 mismatch.describe())
227<<<<<<< TREE
228
229
230class DoesNotStartWithTests(TestCase):
231
232 def test_describe(self):
233 mismatch = DoesNotStartWith("foo", "bar")
234 self.assertEqual(
235 "'foo' does not start with 'bar'.", mismatch.describe())
236
237
238class StartsWithTests(TestCase):
239
240 def test_str(self):
241 matcher = StartsWith("bar")
242 self.assertEqual("Starts with 'bar'.", str(matcher))
243
244 def test_match(self):
245 matcher = StartsWith("bar")
246 self.assertIs(None, matcher.match("barf"))
247
248 def test_mismatch_returns_does_not_start_with(self):
249 matcher = StartsWith("bar")
250 self.assertIsInstance(matcher.match("foo"), DoesNotStartWith)
251
252 def test_mismatch_sets_matchee(self):
253 matcher = StartsWith("bar")
254 mismatch = matcher.match("foo")
255 self.assertEqual("foo", mismatch.matchee)
256
257 def test_mismatch_sets_expected(self):
258 matcher = StartsWith("bar")
259 mismatch = matcher.match("foo")
260 self.assertEqual("bar", mismatch.expected)
261227
262228
263class DoesNotContainTests(TestCase):229class DoesNotContainTests(TestCase):
@@ -291,5 +257,3 @@
291 matcher = Contains("bar")257 matcher = Contains("bar")
292 mismatch = matcher.match("foo")258 mismatch = matcher.match("foo")
293 self.assertEqual("bar", mismatch.expected)259 self.assertEqual("bar", mismatch.expected)
294=======
295>>>>>>> MERGE-SOURCE
296260
=== modified file 'versions.cfg'
--- versions.cfg 2010-11-12 00:45:09 +0000
+++ versions.cfg 2010-11-11 02:23:21 +0000
@@ -62,16 +62,8 @@
62simplesettings = 0.462simplesettings = 0.4
63SimpleTal = 4.163SimpleTal = 4.1
64sourcecodegen = 0.6.964sourcecodegen = 0.6.9
65<<<<<<< TREE
66storm = 0.1865storm = 0.18
67testtools = 0.9.8-r12866testtools = 0.9.8-r128
68=======
69# lp:~gary/storm/0.17-launchpad has the branch for this distribution. It is
70# 0.17 plus r374 from storm trunk for fixing lp:620508 (in order to address
71# lp:627442).
72storm = 0.17-launchpad-1
73testtools = 0.9.7
74>>>>>>> MERGE-SOURCE
75transaction = 1.0.067transaction = 1.0.0
76Twisted = 10.1.068Twisted = 10.1.0
77uuid = 1.3069uuid = 1.30