[Python-checkins] gh-99892: test_unicodedata: skip test on download failure (GH-100011)

miss-islington webhook-mailer at python.org
Mon Dec 5 11:07:07 EST 2022


https://github.com/python/cpython/commit/4a7612fbecbdd81a6e708e29aab0dc4c6555948d
commit: 4a7612fbecbdd81a6e708e29aab0dc4c6555948d
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-12-05T08:07:00-08:00
summary:

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 2488c1e1b66366a3a933ff248eff080fabd2351c)

Co-authored-by: Victor Stinner <vstinner at python.org>

files:
A Misc/NEWS.d/next/Tests/2022-12-05-16-12-56.gh-issue-99892.sz_eW8.rst
M Lib/test/test_unicodedata.py

diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
index 85a3c2d6d544..9e0097c892e7 100644
--- a/Lib/test/test_unicodedata.py
+++ b/Lib/test/test_unicodedata.py
@@ -12,7 +12,8 @@
 import unicodedata
 import unittest
 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):
@@ -345,8 +346,8 @@ def test_normalization(self):
         except PermissionError:
             self.skipTest(f"Permission error when downloading {TESTDATAURL} "
                           f"into the test data directory")
-        except (OSError, HTTPException):
-            self.fail(f"Could not retrieve {TESTDATAURL}")
+        except (OSError, HTTPException) as exc:
+            self.skipTest(f"Failed to download {TESTDATAURL}: {exc}")
 
         with testdata:
             self.run_normalization_tests(testdata)
diff --git a/Misc/NEWS.d/next/Tests/2022-12-05-16-12-56.gh-issue-99892.sz_eW8.rst b/Misc/NEWS.d/next/Tests/2022-12-05-16-12-56.gh-issue-99892.sz_eW8.rst
new file mode 100644
index 000000000000..eded0361fbeb
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2022-12-05-16-12-56.gh-issue-99892.sz_eW8.rst
@@ -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.



More information about the Python-checkins mailing list