[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Change warning to exception in testcase.py

From: Branko Čibej <brane_at_xbc.nu>
Date: 2003-09-11 03:49:06 CEST

B. W. Fitzpatrick wrote:

>I'm sending this here for review before applying because I know it's a
>bit of a militant move, but it will sure keep people from returning a
>status code from their tests. :)
>
>After applying this patch (or a variant of it), we can officially close
>Issue #1192, thanks to Erik Hsmann for doing most of the work to
>finally finish this off.
>
>
If the tests pass with this change, then it's obviously fine.

>+
>+class SVNTestStatusCodeError(Exception):
>+ 'Test driver returned a status code.'
>+ pass
>+
>+
> class _Predicate:
> """A general-purpose predicate that encapsulates a test case (function),
> a condition for its execution and a set of display properties for test
>@@ -92,13 +98,15 @@
> print self.pred.skip_text(),
> else:
> try:
>- # FIXME: Remove this return code check after all tests
>- # have # been converted to throw exceptions instead of
>- # returning error codes.
> rc = apply(self.pred.func, args)
> if rc is not None:
> error = rc
>- print 'WARNING: Test driver returned a status code'
>+ raise SVNTestStatusCodeError
>+ except SVNTestStatusCodeError, ex:
>+ print "STYLE ERROR in",
>+ self._print_name()
>+ print ex.__doc__
>+ sys.exit(255)
>
>

Why on earth do you need a new exception class and handler? instead of
raising this exception and catching it in the same try block, just print
an error message and exit, right?

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Sep 11 03:49:54 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.