Kaydet (Commit) 2dab865f authored tarafından Antoine Pitrou's avatar Antoine Pitrou

When open_urlresource() fails, HTTPException is another possible error

üst 0306894f
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
import sys, codecs import sys, codecs
import unittest, re import unittest, re
from httplib import HTTPException
from test import test_support from test import test_support
from StringIO import StringIO from StringIO import StringIO
...@@ -268,7 +269,7 @@ class TestBase_Mapping(unittest.TestCase): ...@@ -268,7 +269,7 @@ class TestBase_Mapping(unittest.TestCase):
unittest.TestCase.__init__(self, *args, **kw) unittest.TestCase.__init__(self, *args, **kw)
try: try:
self.open_mapping_file() # test it to report the error early self.open_mapping_file() # test it to report the error early
except IOError: except (IOError, HTTPException):
self.skipTest("Could not retrieve "+self.mapfileurl) self.skipTest("Could not retrieve "+self.mapfileurl)
def open_mapping_file(self): def open_mapping_file(self):
......
from test.test_support import run_unittest, open_urlresource from test.test_support import run_unittest, open_urlresource
import unittest import unittest
from httplib import HTTPException
import sys import sys
import os import os
from unicodedata import normalize, unidata_version from unicodedata import normalize, unidata_version
...@@ -43,7 +44,7 @@ class NormalizationTest(unittest.TestCase): ...@@ -43,7 +44,7 @@ class NormalizationTest(unittest.TestCase):
# Hit the exception early # Hit the exception early
try: try:
open_urlresource(TESTDATAURL) open_urlresource(TESTDATAURL)
except IOError: except (IOError, HTTPException):
self.skipTest("Could not retrieve " + TESTDATAURL) self.skipTest("Could not retrieve " + TESTDATAURL)
for line in open_urlresource(TESTDATAURL): for line in open_urlresource(TESTDATAURL):
if '#' in line: if '#' in line:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment