File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 20
20
import warnings
21
21
from test import support
22
22
from test .support import _4G , bigmemtest , import_fresh_module
23
+ from http .client import HTTPException
23
24
24
25
# Were we compiled --with-pydebug or with #define Py_DEBUG?
25
26
COMPILED_WITH_PYDEBUG = hasattr (sys , 'gettotalrefcount' )
@@ -54,8 +55,13 @@ def hexstr(s):
54
55
URL = "http://www.pythontest.net/hashlib/{}.txt"
55
56
56
57
def read_vectors (hash_name ):
57
- with support .open_urlresource (URL .format (hash_name )) as f :
58
- for line in f :
58
+ url = URL .format (hash_name )
59
+ try :
60
+ testdata = support .open_urlresource (url )
61
+ except (OSError , HTTPException ):
62
+ raise unittest .SkipTest ("Could not retrieve {}" .format (url ))
63
+ with testdata :
64
+ for line in testdata :
59
65
line = line .strip ()
60
66
if line .startswith ('#' ) or not line :
61
67
continue
You can’t perform that action at this time.
0 commit comments