[Python-Dev] Using temp files and the Internet in regression tests

Guido van Rossum guido@python.org
Sun, 13 Apr 2003 09:22:35 -0400


> > > Connecting to the Internet: only if the network resource is enabled.
> > > Then it is up to the tester to make sure that connection to the
> > > Internet is possible.
> > 
> > Any suggestions on how to go about this?  An initial connection to
> > python.org after setting socket.setdefaulttimeout() to something
> > reasonable (like 10 seconds?) and raising test_support.TestSkipped if it
> > times out?
> 
> No, you check whether the 'network' resource name is enabled in
> test_support.  Use test_support.is_resource_enabled('network').

I realize that you might not know how to run such tests either.  The
magic words are

  regrtest.py -u network

BTW, this isn't described in Lib/test/README -- perhaps you or someone
else can add it?  (Both the -u option and the is_resource_enabled()
function.)

Hm, maybe these docs shouldn't be so hidden and there should be a
standard library chapter on the test package and its submodules and
the conventions for writing and running tests?

--Guido van Rossum (home page: http://www.python.org/~guido/)