test isolation: default ignores & repository acquisition

John Arbash Meinel john at arbash-meinel.com
Thu Sep 17 14:03:56 BST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


...

> Go ahead, tell us clearly that you would implement a pseudo file
> system in memory ! :D
> 
> I'm fine with having more focused test base classes, I think we
> need to create *more* test classes in the tests themselves
> anyway, one class by test being the extreme, we are actually
> closer to using a single class by test file, which is bad. 
> 
> Using more, better focused, test classes helps writing good setUp
> methods which in turn give simpler test methods.
> 
>        Vincent
> 
> 

The problem I've had trying to do that is that then I end up with:

class TestFunctionFoo(TestCase):


class TestFunctionFooOnDisk(TestCaseInTempDir):


Which never really sat well with me. Maybe it is the 'right way', but it
seemed better to me to have:

class TestFunctionFoo(Test...):

 def test_aspect_on_disk(self):
    self.do_setup_on_disk()
    ...

 def test_aspect(self):
    self.do_setup_in_memory()
    ...


For *me* having the tests of 'aspect' next to each other is a bigger win
than grouping them by set up.

Certainly when writing the tests I end up with: "Oh, this needs disk, so
let me find another location location in the file to write it", rather
than "start calling self.use_disk()".

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEUEARECAAYFAkqyM7wACgkQJdeBCYSNAAOFlQCfQ7XSr9BsxmIRDSrNpMrSl2x5
vz8AlR+3NvnhxLN2nhPkNYhpeHRRHCk=
=qd2+
-----END PGP SIGNATURE-----



More information about the bazaar mailing list