Commit 1a305fd1 authored by Antoine Pitrou's avatar Antoine Pitrou

Merged revisions 76535 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76535 | antoine.pitrou | 2009-11-26 13:36:30 +0100 (jeu., 26 nov. 2009) | 3 lines

  When open_urlresource() fails, HTTPException is another possible error
........
parent 3b713b01
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
import sys, codecs import sys, codecs
import unittest, re import unittest, re
from http.client import HTTPException
from test import support from test import support
from io import BytesIO from io import BytesIO
...@@ -278,7 +279,7 @@ class TestBase_Mapping(unittest.TestCase): ...@@ -278,7 +279,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.support import run_unittest, open_urlresource from test.support import run_unittest, open_urlresource
import unittest import unittest
from http.client import HTTPException
import sys import sys
import os import os
from unicodedata import normalize, unidata_version from unicodedata import normalize, unidata_version
...@@ -45,7 +46,7 @@ class NormalizationTest(unittest.TestCase): ...@@ -45,7 +46,7 @@ class NormalizationTest(unittest.TestCase):
# Hit the exception early # Hit the exception early
try: try:
open_urlresource(TESTDATAURL, encoding="utf-8") open_urlresource(TESTDATAURL, encoding="utf-8")
except IOError: except (IOError, HTTPException):
self.skipTest("Could not retrieve " + TESTDATAURL) self.skipTest("Could not retrieve " + TESTDATAURL)
for line in open_urlresource(TESTDATAURL, encoding="utf-8"): for line in open_urlresource(TESTDATAURL, encoding="utf-8"):
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