Ezio Melotti <ezio.melo...@gmail.com> added the comment:

FWIW there's also support.open_urlresource that can be used to download test 
data.  open_urlresouce calls requires('urlfetch') and skips the test when the 
resource is not enabled.  For instance, test_normalization uses it:
try:
    testdata = support.open_urlresource(TESTDATAURL, encoding="utf-8",
                                        check=check_version)
except (IOError, HTTPException):
    self.skipTest("Could not retrieve " + TESTDATAURL)
self.addCleanup(testdata.close)

This also saves the file on the disk and reuses it when the test is run again, 
so the connection is actually used once and only if available.

----------
nosy: +ezio.melotti

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12804>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to