[MERGE] TestCaseWithMemoryTransport

Robert Collins robertc at robertcollins.net
Wed Oct 4 03:25:55 BST 2006


On Fri, 2006-09-29 at 16:47 -0500, John Arbash Meinel wrote:
> Robert Collins wrote:
> > This patch add TestCaseWithMemoryTransport, a base class between
> > TestCase and TestCaseInTempDir.
> > 
> > It does not setup per-test test directories, and calls to get_transport
> > always get MemoryTransport. it does not have make_branch_and_tree,
> > rather it has make_branch_and_memory_tree() only, allowing this to be
> > used for very fast precise tests.
> > 
> > -Rob
> 
> If it isn't setting up per-test directories, what HOME does it use?

This is for tests that dont need disk resources, so what it does is
chdir to the TEST_ROOT, and set HOME to TEST_ROOT +
'/MemoryTransportMissingHomeDir' which does not exist - if its accessed
it will blow up.

> One bug that we have, is that any test that might modify ~/.bazaar/*
> must use TestCaseInTempDir so that it gets a unique HOME, otherwise we
> use 'cwd' which is usually the root of the bzr tree.
> 
> We *could* have bzrlib.tests.TestCase always create the test000X.tmp
> directory, and set $HOME in there. But you still have the problem that
> multiple runs will re-use the same $HOME.
> 
> Anyway, I think we do need to create the test specific directories,
> because of potential issues with $HOME.

With my explanation above is this enough ?

> (Remember, wt.is_ignored() has the ultimate side effect of creating
> ~/.bazaar/ignore if it doesn't exist)

Yeah, I think thats fairly ugly though : having a library do random
things to your filesystem is not nice for developers using the library.
Doing it for 'bzr' is fine. Perhaps we should open a bug on this ?

Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061004/efab895e/attachment.pgp 


More information about the bazaar mailing list