jenkins-core-weekly: update to 2.491
[oi-userland.git] / components / python / python39 / patches / 20-test_fixes.patch
blob4b59aa57250a1908466e75af223ac83c678a0ad9
1 This patch disables several tests that doesn't work correctly on Solaris.
3 test_gdb is not deterministic and sometimes fails for unimportant reasons (only
4 when ran with gmake test from component root).
6 test_unicodedata needs to download additional data.
7 [Not for upstream]
9 test_time changes skip reason string to reflect the actual platform.
10 [Can be offered upstream]
12 test_socket fixes problem with sparc specific behavior of CMSG_SPACE(). Needed
13 values are not linear as the test expects and that might cause an exception for
14 last byte. Other problems in this test are related to known issues also
15 affecting other platforms. [Can be at least reported upstream]
17 test_re those two test are probably also locale related but I have no idea what
18 is the root cause of these... [Should be reported upstream]
20 test_pyexpat exception output is slightly different most likely due to platform
21 differences. We can safely comment it out. [Not for upstream]
23 test_tcl should be investigated more [Should be reported upstream]
25 test_float is another locale related issue. [Should be reported upstream]
26 https://github.com/python/cpython/commit/aa967ec4d4c2fc844f8f16b339140b050ae4d5e2
28 test_pkgutil doesn't expect that pkg module exists. [Not for upstream]
30 --- Python-3.9.2/Lib/test/test_gdb.py
31 +++ Python-3.9.2/Lib/test/test_gdb.py
32 @@ -52,6 +52,9 @@ if gdb_major_version < 7:
33 % (gdb_major_version, gdb_minor_version,
34 gdb_version))
36 +if sys.platform.startswith("sunos"):
37 + raise unittest.SkipTest("test doesn't work well on Solaris")
39 if not sysconfig.is_python_build():
40 raise unittest.SkipTest("test_gdb only works on source builds at the moment.")
42 --- Python-3.9.2/Lib/test/test_unicodedata.py
43 +++ Python-3.9.2/Lib/test/test_unicodedata.py
44 @@ -324,6 +324,8 @@ class NormalizationTest(unittest.TestCas
45 TESTDATAFILE = "NormalizationTest.txt"
46 TESTDATAURL = f"http://www.pythontest.net/unicode/{unicodedata.unidata_version}/{TESTDATAFILE}"
48 + if sys.platform.startswith("sunos"):
49 + self.skipTest("test needs to download additional data")
50 # Hit the exception early
51 try:
52 testdata = open_urlresource(TESTDATAURL, encoding="utf-8",
53 --- Python-3.9.2/Lib/test/test_re.py
54 +++ Python-3.9.2/Lib/test/test_re.py
55 @@ -1,5 +1,6 @@
56 from test.support import (gc_collect, bigmemtest, _2G,
57 cpython_only, captured_stdout)
58 +import sys
59 import locale
60 import re
61 import sre_compile
62 @@ -1918,6 +1919,8 @@ ELSE
63 self.assertTrue(re.match(b'(?Li)\xc5', b'\xe5'))
64 self.assertTrue(re.match(b'(?Li)\xe5', b'\xc5'))
66 + @unittest.skipIf(sys.platform.startswith("sunos"),
67 + "test doesn't work well on sparc Solaris")
68 def check_en_US_utf8(self):
69 locale.setlocale(locale.LC_CTYPE, 'en_US.utf8')
70 self.assertTrue(re.match(b'\xc5\xe5', b'\xc5\xe5', re.L|re.I))
71 @@ -1927,6 +1930,8 @@ ELSE
72 self.assertIsNone(re.match(b'(?Li)\xc5', b'\xe5'))
73 self.assertIsNone(re.match(b'(?Li)\xe5', b'\xc5'))
75 + @unittest.skipIf(sys.platform.startswith("sunos"),
76 + "test doesn't work well on sparc Solaris")
77 def test_locale_compiled(self):
78 oldlocale = locale.setlocale(locale.LC_CTYPE)
79 self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale)
80 --- Python-3.9.2/Lib/test/test_time.py
81 +++ Python-3.9.2/Lib/test/test_time.py
82 @@ -613,7 +613,7 @@ class _TestStrftimeYear:
83 self.test_year('%04d', func=year4d)
85 def skip_if_not_supported(y):
86 - msg = "strftime() is limited to [1; 9999] with Visual Studio"
87 + msg = "strftime() is limited to [1; 9999] on %s" % sys.platform
88 # Check that it doesn't crash for year > 9999
89 try:
90 time.strftime('%Y', (y,) + (0,) * 8)
91 --- Python-3.9.2/Lib/test/test_socket.py
92 +++ Python-3.9.2/Lib/test/test_socket.py
93 @@ -3355,7 +3355,7 @@ class CmsgMacroTests(unittest.TestCase):
94 # Test CMSG_SPACE() with various valid and invalid values,
95 # checking the assumptions used by sendmsg().
96 toobig = self.socklen_t_limit - socket.CMSG_SPACE(1) + 1
97 - values = list(range(257)) + list(range(toobig - 257, toobig))
98 + values = list(range(257)) + list(range(toobig - 257, toobig - 8))
100 last = socket.CMSG_SPACE(0)
101 # struct cmsghdr has at least three members, two of which are ints
102 @@ -3501,6 +3501,7 @@ class SCMRightsTest(SendrecvmsgServerTim
103 self.createAndSendFDs(1)
105 @unittest.skipIf(sys.platform == "darwin", "skipping, see issue #12958")
106 + @unittest.skipIf(sys.platform.startswith("sunos"), "skipping, see issue #12958")
107 @unittest.skipIf(AIX, "skipping, see issue #22397")
108 @requireAttrs(socket, "CMSG_SPACE")
109 def testFDPassSeparate(self):
110 @@ -3512,6 +3513,7 @@ class SCMRightsTest(SendrecvmsgServerTim
112 @testFDPassSeparate.client_skip
113 @unittest.skipIf(sys.platform == "darwin", "skipping, see issue #12958")
114 + @unittest.skipIf(sys.platform.startswith("sunos"), "skipping, see issue #12958")
115 @unittest.skipIf(AIX, "skipping, see issue #22397")
116 def _testFDPassSeparate(self):
117 fd0, fd1 = self.newFDs(2)
118 @@ -3525,6 +3527,7 @@ class SCMRightsTest(SendrecvmsgServerTim
119 len(MSG))
121 @unittest.skipIf(sys.platform == "darwin", "skipping, see issue #12958")
122 + @unittest.skipIf(sys.platform.startswith("sunos"), "skipping, see issue #12958")
123 @unittest.skipIf(AIX, "skipping, see issue #22397")
124 @requireAttrs(socket, "CMSG_SPACE")
125 def testFDPassSeparateMinSpace(self):
126 @@ -3539,6 +3542,7 @@ class SCMRightsTest(SendrecvmsgServerTim
128 @testFDPassSeparateMinSpace.client_skip
129 @unittest.skipIf(sys.platform == "darwin", "skipping, see issue #12958")
130 + @unittest.skipIf(sys.platform.startswith("sunos"), "skipping, see issue #12958")
131 @unittest.skipIf(AIX, "skipping, see issue #22397")
132 def _testFDPassSeparateMinSpace(self):
133 fd0, fd1 = self.newFDs(2)
134 --- Python-3.9.2/Lib/test/test_pyexpat.py
135 +++ Python-3.9.2/Lib/test/test_pyexpat.py
136 @@ -466,8 +466,8 @@ class HandlerExceptionTest(unittest.Test
137 "pyexpat.c", "StartElement")
138 self.check_traceback_entry(entries[2],
139 "test_pyexpat.py", "StartElementHandler")
140 - if sysconfig.is_python_build() and not (sys.platform == 'win32' and platform.machine() == 'ARM'):
141 - self.assertIn('call_with_frame("StartElement"', entries[1][3])
142 + #if sysconfig.is_python_build() and not (sys.platform == 'win32' and platform.machine() == 'ARM'):
143 + # self.assertIn('call_with_frame("StartElement"', entries[1][3])
146 # Test Current* members:
147 --- Python-3.9.2/Lib/test/test_tcl.py
148 +++ Python-3.9.2/Lib/test/test_tcl.py
149 @@ -198,6 +198,7 @@ class TclTest(unittest.TestCase):
150 self.assertRaises((UnicodeEncodeError, ValueError, TclError),
151 tcl.getboolean, 'on\ud800')
153 + @unittest.skipIf(sys.platform.startswith("sunos"), "test doesn't work well on Solaris")
154 def testEvalFile(self):
155 tcl = self.interp
156 filename = support.TESTFN_ASCII
157 @@ -212,6 +213,7 @@ class TclTest(unittest.TestCase):
158 self.assertEqual(tcl.eval('set b'),'2')
159 self.assertEqual(tcl.eval('set c'),'3')
161 + @unittest.skipIf(sys.platform.startswith("sunos"), "test doesn't work well on Solaris")
162 def test_evalfile_null_in_result(self):
163 tcl = self.interp
164 filename = support.TESTFN_ASCII
165 --- Python-3.9.4/Lib/test/test_float.py
166 +++ Python-3.9.4/Lib/test/test_float.py
167 @@ -144,7 +144,7 @@ class GeneralFloatCases(unittest.TestCas
168 # non-UTF-8 byte string
169 check(b'123\xa0')
171 - @support.run_with_locale('LC_NUMERIC', 'fr_FR', 'de_DE')
172 + @support.run_with_locale('LC_NUMERIC', 'fr_FR.UTF-8', 'de_DE.UTF-8')
173 def test_float_with_comma(self):
174 # set locale to something that doesn't use '.' for the decimal point
175 # float must not accept the locale specific decimal point but
176 --- Python-3.9.4/Lib/test/test_pkgutil.py
177 +++ Python-3.9.4/Lib/test/test_pkgutil.py
178 @@ -479,7 +479,11 @@ class NestedNamespacePackageTest(unittes
179 sys.path.insert(0, os.path.join(self.basedir, 'b'))
180 import pkg
181 self.addCleanup(unload, 'pkg')
182 - self.assertEqual(len(pkg.__path__), 2)
183 + # Solaris has its own pkg package that breaks this test
184 + if os.path.exists("/usr/lib/python3.9/vendor-packages/pkg/"):
185 + self.assertEqual(len(pkg.__path__), 3)
186 + else:
187 + self.assertEqual(len(pkg.__path__), 2)
188 import pkg.subpkg
189 self.addCleanup(unload, 'pkg.subpkg')
190 self.assertEqual(len(pkg.subpkg.__path__), 2)