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

Re: [PATCH] print debug information when subprocess.Popen subprocess.Popen

From: Masaru Tsuchiyama <m.tmatma_at_gmail.com>
Date: Sat, 03 Aug 2013 11:04:30 +0900

> Please send patches as text/plain (*.txt extension often does this).

I understand.

> Masaru Tsuchiyama wrote on Sun, Jul 28, 2013 at 20:00:27 +0900:
> > +++ subversion/tests/cmdline/svntest/main.py (working copy)
> > @@ -412,12 +412,19 @@
> > if not stderr:
> > stderr = subprocess.PIPE
> >
> > - p = subprocess.Popen(command,
> > + try:
> > + p = subprocess.Popen(command,
> > bufsize,
> > stdin=stdin,
> > stdout=stdout,
> > stderr=stderr,
> > close_fds=not windows)
> > + except:
>
> Don't catch everything. Here you can/should catch only CalledProcessError.

I encountered WindowsError exception on Windows Python 2.7.
I'm not sure which expection is raised on Linux/UNIX.
So I catch all, and reraise it.

> > + # catch expeption, print information, and reraise
> > + print "current dir:", os.path.abspath(os.getcwd())
> > + print command
>
> Makes me twitchy. svntest is a library and it shouldn't print, since
> this assumes no caller catches the exception. If possible I'd rather
> annotate the exception object and re-raise it.

Could you tell me how to 'annotate an exception'?

> Also you should use a print() when possible for Python 3 compatibility.

I understand.

> I haven't looked at the context, but I assume this is to address the
> failure mode of running tests before the svn* binaries are built?

I used checkout_tests.py, export_tests.py, prop_tests.py, and
update_test.py respectively. At the time, I needed to copy the test
binaries manually to the location which these scripts expected.

-- 
Masaru Tsuchiyama <m.tmatma_at_gmail.com>
Received on 2013-08-03 04:05:06 CEST

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