gh-99892: test_unicodedata: skip test on download failure (GH-100011)

Skip test_normalization() of test_unicodedata if it fails to download
NormalizationTest.txt file from pythontest.net.
(cherry picked from commit 2488c1e1b6)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2022-12-05 08:07:00 -08:00 committed by GitHub
parent 5533cf67e7
commit 4a7612fbec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -12,7 +12,8 @@ import sys
import unicodedata import unicodedata
import unittest import unittest
from test.support import (open_urlresource, requires_resource, script_helper, from test.support import (open_urlresource, requires_resource, script_helper,
cpython_only, check_disallow_instantiation) cpython_only, check_disallow_instantiation,
ResourceDenied)
class UnicodeMethodsTest(unittest.TestCase): class UnicodeMethodsTest(unittest.TestCase):
@ -345,8 +346,8 @@ class NormalizationTest(unittest.TestCase):
except PermissionError: except PermissionError:
self.skipTest(f"Permission error when downloading {TESTDATAURL} " self.skipTest(f"Permission error when downloading {TESTDATAURL} "
f"into the test data directory") f"into the test data directory")
except (OSError, HTTPException): except (OSError, HTTPException) as exc:
self.fail(f"Could not retrieve {TESTDATAURL}") self.skipTest(f"Failed to download {TESTDATAURL}: {exc}")
with testdata: with testdata:
self.run_normalization_tests(testdata) self.run_normalization_tests(testdata)

View file

@ -0,0 +1,2 @@
Skip test_normalization() of test_unicodedata if it fails to download
NormalizationTest.txt file from pythontest.net. Patch by Victor Stinner.