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

Re: [PATCH] tests: fix len(contents) for error output, if contents is None

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 26 Aug 2008 15:16:56 +0100

On Thu, 2008-08-21 at 23:13 +0200, Neels Janosch Hofmeyr wrote:
> Julian Foad wrote:
> > On Thu, 2008-08-21 at 03:53 +0200, Neels Janosch Hofmeyr wrote:
> >> [[[
> >> * subversion/tests/cmdline/svntest/tree.py (pprint): Fix failure to get
> >> len(contents) for error output, for the case that contents is `None'.
> >> ]]]
> >
> > Neels, this patch fixes the case where the MIME type is set to something
> > (but not something beginning with "text/") and content is None. If the
> > MIME type is set, I don't think it makes sense for the content to be
> > None. If some caller is setting content to None, maybe the caller is
> > broken.
> >
> > There might be some complication, like if the object being represented
> > is a deleted file, and therefore its content is None, and for some
> > reason the properties have not been deleted. (There is currently a bug
> > in Subversion whereby the working properties can still be accessed by
> > some of svn's property commands when an object is scheduled for
> > deletion. Maybe that sort of thing is happening here.)
> >
> > Does that make sense? Did you find a case where this happens?
> Well, I had the simple case where I tried to write a test with binary data,
> and I set the MIME type property, but forgot to add binary `content'.
> `content' was None, the node mismatched, it tried to len() it, exception.
> With the fix, instead of aborting mid-sentence and printing a test-unrelated
> exception, it prints something like "contents: 0 bytes binary data" and
> continues with the rest of the normal error output.
> It's a corner case where one wrote a dumb test, but I'd say it should be
> reported in a useful manner.

To me it seems like adding explicit checks for this would be against the
spirit of Python (in which errors like this are caught by exceptions),
so I don't want to make this change.

However, I wouldn't stop somebody else from doing it if they feel it
really is worth it.

- Julian

To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-08-26 16:17:08 CEST

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.