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
1=== modified file 'lib/canonical/launchpad/ftests/test_wadl_generation.py'
2--- lib/canonical/launchpad/ftests/test_wadl_generation.py 2010-10-01 19:30:55 +0000
3+++ lib/canonical/launchpad/ftests/test_wadl_generation.py 2010-11-12 00:45:16 +0000
4@@ -10,6 +10,8 @@
5 import subprocess
6 import tempfile
7
8+from testtools.matchers import StartsWith
9+
10 from zope.component import getUtility
11
12 from canonical.launchpad.rest.wadl import generate_wadl, generate_html
13@@ -17,10 +19,7 @@
14 from canonical.testing import LaunchpadFunctionalLayer
15 from lazr.restful.interfaces import IWebServiceConfiguration
16 from lp.testing import TestCase
17-from lp.testing.matchers import (
18- Contains,
19- StartsWith,
20- )
21+from lp.testing.matchers import Contains
22
23
24 class SmokeTestWadlAndDocGeneration(TestCase):
25
26=== modified file 'lib/lp/bugs/model/tests/test_bug.py'
27--- lib/lp/bugs/model/tests/test_bug.py 2010-11-12 00:45:09 +0000
28+++ lib/lp/bugs/model/tests/test_bug.py 2010-10-26 15:47:24 +0000
29@@ -3,12 +3,6 @@
30
31 __metaclass__ = type
32
33-<<<<<<< TREE
34-=======
35-from storm.store import ResultSet
36-from testtools.matchers import StartsWith
37-
38->>>>>>> MERGE-SOURCE
39 from canonical.testing.layers import DatabaseFunctionalLayer
40 from lp.registry.enum import BugNotificationLevel
41 from lp.registry.interfaces.person import PersonVisibility
42
43=== modified file 'lib/lp/code/model/branchjob.py'
44--- lib/lp/code/model/branchjob.py 2010-11-07 12:17:44 +0000
45+++ lib/lp/code/model/branchjob.py 2010-11-12 00:45:16 +0000
46@@ -54,6 +54,7 @@
47 classProvides,
48 implements,
49 )
50+from zope.security.proxy import removeSecurityProxy
51
52 from canonical.config import config
53 from canonical.database.enumcol import EnumCol
54
55=== modified file 'lib/lp/code/model/tests/test_branchpuller.py'
56--- lib/lp/code/model/tests/test_branchpuller.py 2010-11-08 13:50:40 +0000
57+++ lib/lp/code/model/tests/test_branchpuller.py 2010-11-12 00:45:16 +0000
58@@ -61,7 +61,7 @@
59 """requestMirror sets the mirror request time to 'now'."""
60 branch = self.makeAnyBranch()
61 branch.requestMirror()
62- self.assertEqual(branch.next_mirror_time, UTC_NOW)
63+ self.assertSqlAttributeEqualsDate(branch, 'next_mirror_time', UTC_NOW)
64
65 def test_requestMirror_doesnt_demote_branch(self):
66 # requestMirror() sets the mirror request time to 'now' unless
67@@ -78,10 +78,10 @@
68 # requestMirror() sets the mirror request time to 'now' if
69 # next_mirror_time is set and in the future.
70 branch = self.makeAnyBranch()
71- future_time = datetime.now(pytz.UTC) - timedelta(days=1)
72+ future_time = datetime.now(pytz.UTC) + timedelta(days=1)
73 removeSecurityProxy(branch).next_mirror_time = future_time
74 branch.requestMirror()
75- self.assertEqual(branch.next_mirror_time, UTC_NOW)
76+ self.assertSqlAttributeEqualsDate(branch, 'next_mirror_time', UTC_NOW)
77
78 def test_mirroringResetsMirrorRequest(self):
79 """Mirroring branches resets their mirror request times."""
80
81=== modified file 'lib/lp/testing/matchers.py'
82--- lib/lp/testing/matchers.py 2010-11-12 00:45:09 +0000
83+++ lib/lp/testing/matchers.py 2010-11-12 00:45:16 +0000
84@@ -189,43 +189,6 @@
85 return IsProxied().match(matchee)
86
87
88-<<<<<<< TREE
89-class DoesNotStartWith(Mismatch):
90-
91- def __init__(self, matchee, expected):
92- """Create a DoesNotStartWith Mismatch.
93-
94- :param matchee: the string that did not match.
95- :param expected: the string that `matchee` was expected to start
96- with.
97- """
98- self.matchee = matchee
99- self.expected = expected
100-
101- def describe(self):
102- return "'%s' does not start with '%s'." % (
103- self.matchee, self.expected)
104-
105-
106-class StartsWith(Matcher):
107- """Checks whether one string starts with another."""
108-
109- def __init__(self, expected):
110- """Create a StartsWith Matcher.
111-
112- :param expected: the string that matchees should start with.
113- """
114- self.expected = expected
115-
116- def __str__(self):
117- return "Starts with '%s'." % self.expected
118-
119- def match(self, matchee):
120- if not matchee.startswith(self.expected):
121- return DoesNotStartWith(matchee, self.expected)
122- return None
123-
124-
125 class DoesNotContain(Mismatch):
126
127 def __init__(self, matchee, expected):
128@@ -261,8 +224,6 @@
129 return None
130
131
132-=======
133->>>>>>> MERGE-SOURCE
134 class IsConfiguredBatchNavigator(Matcher):
135 """Check that an object is a batch navigator."""
136
137
138=== modified file 'lib/lp/testing/tests/test_matchers.py'
139--- lib/lp/testing/tests/test_matchers.py 2010-11-12 00:45:09 +0000
140+++ lib/lp/testing/tests/test_matchers.py 2010-11-12 00:45:16 +0000
141@@ -224,40 +224,6 @@
142 self.assertEqual(
143 "queries do not match: %s" % (LessThan(2).match(2).describe(),),
144 mismatch.describe())
145-<<<<<<< TREE
146-
147-
148-class DoesNotStartWithTests(TestCase):
149-
150- def test_describe(self):
151- mismatch = DoesNotStartWith("foo", "bar")
152- self.assertEqual(
153- "'foo' does not start with 'bar'.", mismatch.describe())
154-
155-
156-class StartsWithTests(TestCase):
157-
158- def test_str(self):
159- matcher = StartsWith("bar")
160- self.assertEqual("Starts with 'bar'.", str(matcher))
161-
162- def test_match(self):
163- matcher = StartsWith("bar")
164- self.assertIs(None, matcher.match("barf"))
165-
166- def test_mismatch_returns_does_not_start_with(self):
167- matcher = StartsWith("bar")
168- self.assertIsInstance(matcher.match("foo"), DoesNotStartWith)
169-
170- def test_mismatch_sets_matchee(self):
171- matcher = StartsWith("bar")
172- mismatch = matcher.match("foo")
173- self.assertEqual("foo", mismatch.matchee)
174-
175- def test_mismatch_sets_expected(self):
176- matcher = StartsWith("bar")
177- mismatch = matcher.match("foo")
178- self.assertEqual("bar", mismatch.expected)
179
180
181 class DoesNotContainTests(TestCase):
182@@ -291,5 +257,3 @@
183 matcher = Contains("bar")
184 mismatch = matcher.match("foo")
185 self.assertEqual("bar", mismatch.expected)
186-=======
187->>>>>>> MERGE-SOURCE
188
189=== modified file 'versions.cfg'
190--- versions.cfg 2010-11-12 00:45:09 +0000
191+++ versions.cfg 2010-11-11 02:23:21 +0000
192@@ -62,16 +62,8 @@
193 simplesettings = 0.4
194 SimpleTal = 4.1
195 sourcecodegen = 0.6.9
196-<<<<<<< TREE
197 storm = 0.18
198 testtools = 0.9.8-r128
199-=======
200-# lp:~gary/storm/0.17-launchpad has the branch for this distribution. It is
201-# 0.17 plus r374 from storm trunk for fixing lp:620508 (in order to address
202-# lp:627442).
203-storm = 0.17-launchpad-1
204-testtools = 0.9.7
205->>>>>>> MERGE-SOURCE
206 transaction = 1.0.0
207 Twisted = 10.1.0
208 uuid = 1.30