Merge lp:~mbp/bzr/504102-test-isolation into lp:bzr

Proposed by Martin Pool
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~mbp/bzr/504102-test-isolation
Merge into: lp:bzr
Diff against target: 68 lines (+18/-4)
3 files modified
NEWS (+4/-0)
bzrlib/bzrdir.py (+7/-4)
bzrlib/tests/per_bzrdir/test_bzrdir.py (+7/-0)
To merge this branch: bzr merge lp:~mbp/bzr/504102-test-isolation
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+17006@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

The RemoteBzrDirFormat can act as either an archetype for creation, or a description of an actual remote bzrdir. When used to initialize, it should not mutate the archetype, because that smudges global state and causes a test failure.

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

 review: approve
 merge: approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2010-01-08 07:37:25 +0000
+++ NEWS 2010-01-08 08:46:16 +0000
@@ -61,6 +61,10 @@
61 returns ``EINTR`` by calling ``PyErr_CheckSignals``. This affected the61 returns ``EINTR`` by calling ``PyErr_CheckSignals``. This affected the
62 optional ``_readdir_pyx`` extension. (Andrew Bennetts, #495023)62 optional ``_readdir_pyx`` extension. (Andrew Bennetts, #495023)
6363
64* Fixed a side effect mutation of ``RemoteBzrDirFormat._network_name``
65 that caused some tests to fail when run in a non-default order.
66 Probably no user impact. (Martin Pool, #504102)
67
64* FTP transports support Unicode paths by encoding/decoding them as utf8.68* FTP transports support Unicode paths by encoding/decoding them as utf8.
65 (Vincent Ladeuil, #472161)69 (Vincent Ladeuil, #472161)
6670
6771
=== modified file 'bzrlib/bzrdir.py'
--- bzrlib/bzrdir.py 2010-01-08 07:37:25 +0000
+++ bzrlib/bzrdir.py 2010-01-08 08:46:16 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd1# Copyright (C) 2005-2010 Canonical Ltd
2#2#
3# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -3108,6 +3108,10 @@
31083108
3109 def __init__(self):3109 def __init__(self):
3110 BzrDirMetaFormat1.__init__(self)3110 BzrDirMetaFormat1.__init__(self)
3111 # XXX: It's a bit ugly that the network name is here, because we'd
3112 # like to believe that format objects are stateless or at least
3113 # immutable, However, we do at least avoid mutating the name after
3114 # it's returned. See <https://bugs.edge.launchpad.net/bzr/+bug/504102>
3111 self._network_name = None3115 self._network_name = None
31123116
3113 def __repr__(self):3117 def __repr__(self):
@@ -3256,12 +3260,11 @@
3256 args.append(self._serialize_NoneString(repo_format_name))3260 args.append(self._serialize_NoneString(repo_format_name))
3257 args.append(self._serialize_NoneTrueFalse(make_working_trees))3261 args.append(self._serialize_NoneTrueFalse(make_working_trees))
3258 args.append(self._serialize_NoneTrueFalse(shared_repo))3262 args.append(self._serialize_NoneTrueFalse(shared_repo))
3259 if self._network_name is None:3263 request_network_name = self._network_name or \
3260 self._network_name = \
3261 BzrDirFormat.get_default_format().network_name()3264 BzrDirFormat.get_default_format().network_name()
3262 try:3265 try:
3263 response = client.call('BzrDirFormat.initialize_ex_1.16',3266 response = client.call('BzrDirFormat.initialize_ex_1.16',
3264 self.network_name(), path, *args)3267 request_network_name, path, *args)
3265 except errors.UnknownSmartMethod:3268 except errors.UnknownSmartMethod:
3266 client._medium._remember_remote_is_before((1,16))3269 client._medium._remember_remote_is_before((1,16))
3267 local_dir_format = BzrDirMetaFormat1()3270 local_dir_format = BzrDirMetaFormat1()
32683271
=== modified file 'bzrlib/tests/per_bzrdir/test_bzrdir.py'
--- bzrlib/tests/per_bzrdir/test_bzrdir.py 2009-11-18 17:10:41 +0000
+++ bzrlib/tests/per_bzrdir/test_bzrdir.py 2010-01-08 08:46:16 +0000
@@ -1176,6 +1176,13 @@
1176 # because the default open will not open them and1176 # because the default open will not open them and
1177 # they may not be initializable.1177 # they may not be initializable.
1178 return1178 return
1179 # for remote formats, there must be no prior assumption about the
1180 # network name to use - it's possible that this may somehow have got
1181 # in through an unisolated test though - see
1182 # <https://bugs.edge.launchpad.net/bzr/+bug/504102>
1183 self.assertEquals(getattr(self.bzrdir_format,
1184 '_network_name', None),
1185 None)
1179 # supported formats must be able to init and open1186 # supported formats must be able to init and open
1180 t = get_transport(self.get_url())1187 t = get_transport(self.get_url())
1181 readonly_t = get_transport(self.get_readonly_url())1188 readonly_t = get_transport(self.get_readonly_url())