[merge][#249256] correct confusion between format classes and objects

Martin Pool mbp at canonical.com
Thu Jul 17 04:17:17 BST 2008

This patch, started by mwhudson, fixes
<https://bugs.launchpad.net/bzr/+bug/249256>, problems "sometimes" in
building a tree from a remote branch.  I'm not clear on just when it

The root cause is the first patch hunk, that _matchingbzrdir should be
a format instance not a class.

Fixing this found many knock-on test failures, Michael's fix for which
changed the way test scenarios are generated, so that when we're
applying a test to eg a workingtree format, we use the bzrdir format
specified as matching it.  Passing it separately meant that
_matchingbzrdir was not tested when it should have been.  This change
to the normal scenario generator doesn't prevent code generating other
scenarios that mix and match formats in different ways, or for example
tweaking the returned scenarios.

test_setting_vfs_transport was strictly redundant with the following
test so I removed it.

Many of the tests here are passing in for a string (or in one case an
int) where a Format instance is expected.  This happened to pass in
the old code but now needs to be updated to give a real object.

I would say in general that it's nice to have apis work by duck
typing.  But if they do expect an object providing a particular
interface, then the tests ought to provide something matching that
interface, both to make sure it's exercised realistically, and also to
make the test easier to understand.  Looking at the previous version
of these tests someone might have expected that it was format names
that were being passed.

Martin <http://launchpad.net/~mbp/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20080717-249256-tree-from-remote.diff
Type: text/x-diff
Size: 20747 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080717/bd84e584/attachment-0001.bin 

More information about the bazaar mailing list