]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-99892: test_unicodedata: skip test on download failure (#100011)
authorVictor Stinner <vstinner@python.org>
Mon, 5 Dec 2022 15:37:40 +0000 (16:37 +0100)
committerGitHub <noreply@github.com>
Mon, 5 Dec 2022 15:37:40 +0000 (16:37 +0100)
Skip test_normalization() of test_unicodedata if it fails to download
NormalizationTest.txt file from pythontest.net.

Lib/test/test_unicodedata.py
Misc/NEWS.d/next/Tests/2022-12-05-16-12-56.gh-issue-99892.sz_eW8.rst [new file with mode: 0644]

index a85bda3144bc35f55f38986a16732feb53409c2a..74503c89e559a04f4794c7856d1b506758432970 100644 (file)
@@ -12,7 +12,8 @@ import sys
 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):
@@ -364,8 +365,8 @@ class NormalizationTest(unittest.TestCase):
         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 (file)
index 0000000..eded036
--- /dev/null
@@ -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.