test isolation: default ignores & repository acquisition

Martin Pool mbp at canonical.com
Fri Sep 18 00:08:45 BST 2009


2009/9/17 John Arbash Meinel <john at arbash-meinel.com>:
> 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()".

Yes, it's the same for me.  And I think it's much more explicit to
have things explicitly (but concisely) set up in the test, as you have
done, than to have it controlled by an inheritance line possibly many
screens up in the file.

-- 
Martin



More information about the bazaar mailing list