Skip to content

Commit 4a7612f

Browse files
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 2488c1e) Co-authored-by: Victor Stinner <[email protected]>
1 parent 5533cf6 commit 4a7612f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Lib/test/test_unicodedata.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
import unicodedata
1313
import unittest
1414
from test.support import (open_urlresource, requires_resource, script_helper,
15-
cpython_only, check_disallow_instantiation)
15+
cpython_only, check_disallow_instantiation,
16+
ResourceDenied)
1617

1718

1819
class UnicodeMethodsTest(unittest.TestCase):
@@ -345,8 +346,8 @@ def test_normalization(self):
345346
except PermissionError:
346347
self.skipTest(f"Permission error when downloading {TESTDATAURL} "
347348
f"into the test data directory")
348-
except (OSError, HTTPException):
349-
self.fail(f"Could not retrieve {TESTDATAURL}")
349+
except (OSError, HTTPException) as exc:
350+
self.skipTest(f"Failed to download {TESTDATAURL}: {exc}")
350351

351352
with testdata:
352353
self.run_normalization_tests(testdata)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Skip test_normalization() of test_unicodedata if it fails to download
2+
NormalizationTest.txt file from pythontest.net. Patch by Victor Stinner.

0 commit comments

Comments
 (0)