Questions after testtools merge

Jonathan Lange jml at mumak.net
Fri Jan 1 02:57:31 GMT 2010


On Fri, Jan 1, 2010 at 1:42 PM, Jonathan Lange <jml at mumak.net> wrote:
> On Fri, Jan 1, 2010 at 3:27 AM, John Arbash Meinel
> <john at arbash-meinel.com> wrote:
...
>> Because later on we have:
>>
>>        try:
>>            if self.exception_caught == self._run_user(
>>                self.case._run_test_method, self.result):
>>                failed = True
>>        finally:
>>            try:
>>                if self.exception_caught == self._run_user(
>>                    self.case._run_teardown, self.result):
>>                    failed = True
>>            finally:
>>                try:
>>                    if not self._run_user(
>>                        self.case._runCleanups, self.result):
>>                        failed = True
>>                finally:
>>                    if not failed:
>>                        self.result.addSuccess(self.case,
>>                            details=self.case.getDetails())
>>
>> Also, I think we have a bug, looking at addCleanups, it says:
>>    def addCleanup(self, function, *arguments, **keywordArguments):
>>        """Add a cleanup function to be called before tearDown.
>>
>>
>> However, if I read the above correctly, teardown is clearly called
>> *before* cleanups. Which doesn't quite fit with the fact that setUp is
>> called before addCleanup, etc.
>>
>
> The docstring is definitely wrong. Given that you had to delve so
> deeply into the code, it's also inadequate. I'll fix this now.
>

Actually, other than the mistaken docstring, it seems to make the
behaviour pretty clear. I'd be happy to make some improvements if you
can think of any.

The other thing I forgot to mention is that we used to run the
cleanups before tearDown, but we changed to match what Python standard
library does.

jml



More information about the bazaar mailing list