selftest should continue after skip even if --one
Robert Collins
robertc at robertcollins.net
Thu Jan 26 21:59:44 GMT 2006
On Thu, 2006-01-26 at 15:44 -0600, John A Meinel wrote:
> 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.
EarlyStoppingTestResultAdapter exists as a common object in about 5
projects offhand. It implements the unittest result protocol and passes
new methods to the adapted result, so its compatible with most
extensions and result objects with no changes.
> 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.
Sure, we can do that. I'll take the fix to the other users directly.
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: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060127/f074c801/attachment.pgp
More information about the bazaar
mailing list