[Python-checkins] Python Regression Test Failures opt (1)

Brett Cannon brett at python.org
Tue Oct 9 07:57:40 CEST 2007


On 10/8/07, Neal Norwitz <nnorwitz at gmail.com> wrote:
> On 10/8/07, Brett Cannon <brett at python.org> wrote:
> > On 10/8/07, Neal Norwitz <nnorwitz at gmail.com> wrote:
> >
> > [SNIP]
> > > test_asynchat
> > >   WARNING: failed to listen on port 54322, trying another
> > >   WARNING: failed to listen on port 9907, trying another
> > >   WARNING: failed to listen on port 10243, trying another
> > >   WARNING: failed to listen on port 32999, trying another
> > > Exception in thread Thread-34:
> > > Traceback (most recent call last):
> > >   File "/tmp/python-test/local/lib/python2.6/threading.py", line 486, in __bootstrap_inner
> > >     self.run()
> > >   File "/tmp/python-test/local/lib/python2.6/test/test_asynchat.py", line 22, in run
> > >     PORT = test_support.bind_port(sock, HOST, PORT)
> > >   File "/tmp/python-test/local/lib/python2.6/test/test_support.py", line 113, in bind_port
> > >     raise TestFailed('unable to find port to listen on')
> > > TestFailed: unable to find port to listen on
> >
> > Shouldn't the test be skipped instead of considered a failure?  It
> > isn't asynchat's fault that the test code can't find an open port.
>
> It may not be asynchat's fault (haven't looked), but there is another
> test (or asynchat) that isn't cleaning up after itself.  I have a fix
> for this, I just need to check it in.  Probably not tonight.  Maybe
> tomorrow.  It's general, so will fix any test that uses the bind from
> test_support.

Didn't even know about that function in test_support.  Looks like
every use would need a guaranteed closure on that socket.  Sounds like
a good use of a context manager to me (but then again I am a big
proponent of context managers instead of setUp/tearDown when
possible).

But since you already have a solution I am not going to worry about
writing a context manager right now.  =)

-Brett


More information about the Python-checkins mailing list