Merge lp:~jml/launchpad/new-testtools into lp:launchpad

Proposed by Jonathan Lange
Status: Merged
Approved by: Jonathan Lange
Approved revision: no longer in the source branch.
Merged at revision: 11887
Proposed branch: lp:~jml/launchpad/new-testtools
Merge into: lp:launchpad
Diff against target: 173 lines (+25/-27)
4 files modified
lib/lp/code/model/branchjob.py (+4/-1)
lib/lp/code/model/tests/test_branchpuller.py (+3/-3)
lib/lp/poppy/tests/test_poppy.py (+17/-22)
versions.cfg (+1/-1)
To merge this branch: bzr merge lp:~jml/launchpad/new-testtools
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Jonathan Lange (community) Approve
Review via email: mp+40207@code.launchpad.net

Commit message

Upgrade to r128 of testtools trunk, pre-release version.

Description of the change

Upgrade to a pre-release version of testtools. Already have IRC approval from lifeless.

To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) :
review: Approve
Revision history for this message
Jonathan Lange (jml) wrote :

This won't work without an upgrade of fixtures.

Revision history for this message
Robert Collins (lifeless) wrote :

Looks fine.

review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

In passing, the ordering change is a deeper problem that mwh has since landed a fix for - those tests were plain old broken.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/model/branchjob.py'
2--- lib/lp/code/model/branchjob.py 2010-08-20 20:31:18 +0000
3+++ lib/lp/code/model/branchjob.py 2010-11-08 13:53:48 +0000
4@@ -229,8 +229,11 @@
5 # XXX: henninge 2009-02-20 bug=331919: These two standard operators
6 # should be implemented by delegates().
7 def __eq__(self, other):
8+ # removeSecurityProxy, since 'other' might well be a delegated object
9+ # and the context attribute is not exposed by design.
10+ from zope.security.proxy import removeSecurityProxy
11 return (self.__class__ == other.__class__ and
12- self.context == other.context)
13+ self.context == removeSecurityProxy(other).context)
14
15 def __ne__(self, other):
16 return not (self == other)
17
18=== modified file 'lib/lp/code/model/tests/test_branchpuller.py'
19--- lib/lp/code/model/tests/test_branchpuller.py 2010-08-20 20:31:18 +0000
20+++ lib/lp/code/model/tests/test_branchpuller.py 2010-11-08 13:53:48 +0000
21@@ -61,7 +61,7 @@
22 """requestMirror sets the mirror request time to 'now'."""
23 branch = self.makeAnyBranch()
24 branch.requestMirror()
25- self.assertEqual(UTC_NOW, branch.next_mirror_time)
26+ self.assertEqual(branch.next_mirror_time, UTC_NOW)
27
28 def test_requestMirror_doesnt_demote_branch(self):
29 # requestMirror() sets the mirror request time to 'now' unless
30@@ -72,7 +72,7 @@
31 past_time = datetime.now(pytz.UTC) - timedelta(days=1)
32 removeSecurityProxy(branch).next_mirror_time = past_time
33 branch.requestMirror()
34- self.assertEqual(past_time, branch.next_mirror_time)
35+ self.assertEqual(branch.next_mirror_time, past_time)
36
37 def test_requestMirror_can_promote_branch(self):
38 # requestMirror() sets the mirror request time to 'now' if
39@@ -81,7 +81,7 @@
40 future_time = datetime.now(pytz.UTC) - timedelta(days=1)
41 removeSecurityProxy(branch).next_mirror_time = future_time
42 branch.requestMirror()
43- self.assertEqual(UTC_NOW, branch.next_mirror_time)
44+ self.assertEqual(branch.next_mirror_time, UTC_NOW)
45
46 def test_mirroringResetsMirrorRequest(self):
47 """Mirroring branches resets their mirror request times."""
48
49=== modified file 'lib/lp/poppy/tests/test_poppy.py'
50--- lib/lp/poppy/tests/test_poppy.py 2010-10-17 21:21:07 +0000
51+++ lib/lp/poppy/tests/test_poppy.py 2010-11-08 13:53:48 +0000
52@@ -20,6 +20,10 @@
53 multiply_tests,
54 )
55 from bzrlib.transport import get_transport
56+from fixtures import (
57+ EnvironmentVariableFixture,
58+ Fixture,
59+ )
60 import transaction
61 from zope.component import getUtility
62
63@@ -32,12 +36,11 @@
64 from lp.poppy.tests.helpers import PoppyTestSetup
65 from lp.registry.interfaces.ssh import (
66 ISSHKeySet,
67- SSHKeyType,
68 )
69 from lp.testing import TestCaseWithFactory
70
71
72-class FTPServer:
73+class FTPServer(Fixture):
74 """This is an abstraction of connecting to an FTP server."""
75
76 def __init__(self, root_dir, factory):
77@@ -45,12 +48,11 @@
78 self.port = 3421
79
80 def setUp(self):
81+ super(FTPServer, self).setUp()
82 self.poppy = PoppyTestSetup(
83 self.root_dir, port=self.port, cmd='echo CLOSED')
84 self.poppy.startPoppy()
85-
86- def cleanUp(self):
87- self.poppy.killPoppy()
88+ self.addCleanup(self.poppy.killPoppy)
89
90 def getTransport(self):
91 return get_transport('ftp://ubuntu:@localhost:%s/' % (self.port,))
92@@ -87,7 +89,7 @@
93 self.poppy.verify_output(['CLOSED'])
94
95
96-class SFTPServer:
97+class SFTPServer(Fixture):
98 """This is an abstraction of connecting to an SFTP server."""
99
100 def __init__(self, root_dir, factory):
101@@ -112,27 +114,19 @@
102 user, os.path.join(os.path.dirname(__file__), 'poppy-sftp.pub'))
103 # Set up a temporary home directory for Paramiko's sake
104 self._home_dir = tempfile.mkdtemp()
105+ self.addCleanup(shutil.rmtree, self._home_dir)
106 os.mkdir(os.path.join(self._home_dir, '.ssh'))
107 os.symlink(
108 os.path.join(os.path.dirname(__file__), 'poppy-sftp'),
109 os.path.join(self._home_dir, '.ssh', 'id_rsa'))
110- self._current_home = os.environ['HOME']
111- # We'd rather not have an agent interfere
112- os.environ.pop('SSH_AUTH_SOCK', None)
113- os.environ['HOME'] = self._home_dir
114- # XXX: Just blat over the BZR_SSH env var. Restoring env vars is a
115- # little tricky, see lp.testing.TestCaseWithFactory.useTempBzrHome.
116- os.environ['BZR_SSH'] = 'paramiko'
117+ self.useFixture(EnvironmentVariableFixture('HOME', self._home_dir))
118+ self.useFixture(EnvironmentVariableFixture('SSH_AUTH_SOCK', None))
119+ self.useFixture(EnvironmentVariableFixture('BZR_SSH', 'paramiko'))
120
121 def setUp(self):
122+ super(SFTPServer, self).setUp()
123 self.setUpUser('joe')
124- self._tac = PoppyTac(self.root_dir)
125- self._tac.setUp()
126-
127- def cleanUp(self):
128- shutil.rmtree(self._home_dir)
129- os.environ['HOME'] = self._current_home
130- self._tac.tearDown()
131+ self.useFixture(PoppyTac(self.root_dir))
132
133 def disconnect(self, transport):
134 transport._get_connection().close()
135@@ -219,7 +213,7 @@
136
137 transport = self.server.getTransport()
138 transport.stat('foo/bar') # .stat will implicity chdir for us
139-
140+
141 self.server.disconnect(transport)
142 self.server.waitForClose()
143
144@@ -250,7 +244,7 @@
145 transport.mkdir('foo/bar')
146 transport.rmdir('foo/bar')
147 transport.rmdir('foo')
148-
149+
150 self.server.disconnect(transport)
151 self.server.waitForClose()
152
153@@ -362,6 +356,7 @@
154 self.root_dir, upload_dirs[index], "test")).read()
155 self.assertEqual(content, expected_contents[index])
156
157+
158 def test_suite():
159 tests = unittest.TestLoader().loadTestsFromName(__name__)
160 scenarios = [
161
162=== modified file 'versions.cfg'
163--- versions.cfg 2010-11-08 06:45:53 +0000
164+++ versions.cfg 2010-11-08 13:53:48 +0000
165@@ -63,7 +63,7 @@
166 SimpleTal = 4.1
167 sourcecodegen = 0.6.9
168 storm = 0.18
169-testtools = 0.9.6
170+testtools = 0.9.8-r128
171 transaction = 1.0.0
172 Twisted = 10.1.0
173 uuid = 1.30