Kaydet (Commit) 81188246 authored tarafından Christian Heimes's avatar Christian Heimes

Issue 26798: fetch OSError and HTTPException like other tests that use open_urlresource.

üst d9fc792f
...@@ -20,6 +20,7 @@ import unittest ...@@ -20,6 +20,7 @@ import unittest
import warnings import warnings
from test import support from test import support
from test.support import _4G, bigmemtest, import_fresh_module from test.support import _4G, bigmemtest, import_fresh_module
from http.client import HTTPException
# Were we compiled --with-pydebug or with #define Py_DEBUG? # Were we compiled --with-pydebug or with #define Py_DEBUG?
COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount') COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
...@@ -54,8 +55,13 @@ def hexstr(s): ...@@ -54,8 +55,13 @@ def hexstr(s):
URL = "http://www.pythontest.net/hashlib/{}.txt" URL = "http://www.pythontest.net/hashlib/{}.txt"
def read_vectors(hash_name): def read_vectors(hash_name):
with support.open_urlresource(URL.format(hash_name)) as f: url = URL.format(hash_name)
for line in f: try:
testdata = support.open_urlresource(url)
except (OSError, HTTPException):
raise unittest.SkipTest("Could not retrieve {}".format(url))
with testdata:
for line in testdata:
line = line.strip() line = line.strip()
if line.startswith('#') or not line: if line.startswith('#') or not line:
continue continue
......
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