selftest should continue after skip even if --one

John A Meinel john at arbash-meinel.com
Thu Jan 26 21:44:41 GMT 2006


Robert Collins wrote:
> On Thu, 2006-01-26 at 15:26 -0600, John A Meinel wrote:
>> Robert Collins wrote:
>>> On Thu, 2006-01-26 at 11:45 -0600, John A Meinel wrote:
>>>> Robert brought up this bug a while ago, I decided to fix it, and the fix
>>>> is in my 'jam-pending' branch revno:1511
>>>>
>>>> Basically, the problem was that EarlyStoppingAdapter was being wrapped
>>>> around _MyResult, which was causing _result.stop() to be called, before
>>>> _MyResult could realize that it was a SKIP.
>>>>
>>>> I realized that since we use _MyResult anyway, we don't really need the
>>>> EarlyStopping adapter. I don't know if we would want it for other front
>>>> ends, but I don't know that other front ends would support the stop
>>>> early request anyway.
>>>>
>>>> So attached is the patch which fixes it.
>>>>
>>>> Aaron, can you review my jam-pending branch? I put the paramiko fix in
>>>> there as well.
>>> FWIW its already fixed in branch-formats.
>>>
>>> Rob
>>>
>> How did you fix it? I don't want to conflict with your fix.
> 
> Its important to remember that _MyResult is -only- the result used
> by ./bzr selftest - gui test runs for instance do not use our testresult
> object.
> 
> --- bzrlib/tests/__init__.py    
> +++ bzrlib/tests/__init__.py    
> @@ -77,6 +88,9 @@
>          self._result = result
>  
>      def addError(self, test, err):
> +        if (isinstance(err[1], TestSkipped) and 
> +            getattr(self, "addSkipped", None) is not None):
> +            return self.addSkipped(test, err)    
>          self._result.addError(test, err)
>          self._result.stop()
> 
> 
> Rob

But they don't understand our EarlyStoppingAdapter either, considering
they use a different Result object because they use a different
TextTestRunner.

If you look at the code you have:

class TextTestRunner(unittest.TextTestRunner):
    stop_on_failure = False

    def _makeResult(self):
        result = _MyResult(self.stream, self.descriptions, self.verbosity)
        if self.stop_on_failure:
            result = EarlyStoppingTestResultAdapter(result)
        return result

Which means the only place that creates _MyResult is also the *only*
place which uses EarlyStoppingTestResultAdapter.

Since the same place is using 2 classes to do very similar things why
not just merge the functionality into 1. It is much simpler than writing
an adapter class which has __getattr__ and all that stuff.

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060126/b1ef0f70/attachment.pgp 


More information about the bazaar mailing list