diff options
author | Christian Heimes <christian@python.org> | 2016-09-08 08:53:40 (GMT) |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2016-09-08 08:53:40 (GMT) |
commit | 81188246fabdb43efd26f34497131824f49cdc12 (patch) | |
tree | c76a67044854f2a3b7dcbd02a9e36d1b86a0faf4 /Lib | |
parent | d9fc792fda26d5fcd94329465e66628ae19a081a (diff) | |
download | cpython-81188246fabdb43efd26f34497131824f49cdc12.zip cpython-81188246fabdb43efd26f34497131824f49cdc12.tar.gz cpython-81188246fabdb43efd26f34497131824f49cdc12.tar.bz2 |
Issue 26798: fetch OSError and HTTPException like other tests that use open_urlresource.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_hashlib.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py index 21260f6..5ae8c07 100644 --- a/Lib/test/test_hashlib.py +++ b/Lib/test/test_hashlib.py @@ -20,6 +20,7 @@ import unittest import warnings from test import support from test.support import _4G, bigmemtest, import_fresh_module +from http.client import HTTPException # Were we compiled --with-pydebug or with #define Py_DEBUG? COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount') @@ -54,8 +55,13 @@ def hexstr(s): URL = "http://www.pythontest.net/hashlib/{}.txt" def read_vectors(hash_name): - with support.open_urlresource(URL.format(hash_name)) as f: - for line in f: + url = URL.format(hash_name) + 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() if line.startswith('#') or not line: continue |