From 4a352344b6abf257c4050786f2bfd8036da0f715 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Sat, 20 Dec 2025 17:46:05 +0900 Subject: [PATCH] mark failing test_ctypes --- Lib/test/test_ctypes/test_cast.py | 2 ++ Lib/test/test_ctypes/test_dlerror.py | 1 + Lib/test/test_ctypes/test_internals.py | 4 ++++ Lib/test/test_ctypes/test_keeprefs.py | 4 ++++ Lib/test/test_ctypes/test_objects.py | 3 ++- Lib/test/test_ctypes/test_python_api.py | 4 ++++ Lib/test/test_ctypes/test_random_things.py | 2 ++ Lib/test/test_ctypes/test_values.py | 4 ++++ Lib/test/test_ctypes/test_win32.py | 2 ++ Lib/test/test_ctypes/test_win32_com_foreign_func.py | 2 ++ Lib/test/test_exceptions.py | 1 + Lib/test/test_os.py | 3 --- 12 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_ctypes/test_cast.py b/Lib/test/test_ctypes/test_cast.py index 604f44f03..db6bdc75e 100644 --- a/Lib/test/test_ctypes/test_cast.py +++ b/Lib/test/test_ctypes/test_cast.py @@ -32,6 +32,8 @@ class Test(unittest.TestCase): ptr = cast(address, POINTER(c_int)) self.assertEqual([ptr[i] for i in range(3)], [42, 17, 2]) + # TODO: RUSTPYTHON + @unittest.expectedFailure def test_p2a_objects(self): array = (c_char_p * 5)() self.assertEqual(array._objects, None) diff --git a/Lib/test/test_ctypes/test_dlerror.py b/Lib/test/test_ctypes/test_dlerror.py index 1c1b2aab3..cd87bad38 100644 --- a/Lib/test/test_ctypes/test_dlerror.py +++ b/Lib/test/test_ctypes/test_dlerror.py @@ -54,6 +54,7 @@ class TestNullDlsym(unittest.TestCase): this 'dlsym returned NULL -> throw Error' rule. """ + @unittest.expectedFailure # TODO: RUSTPYTHON def test_null_dlsym(self): import subprocess import tempfile diff --git a/Lib/test/test_ctypes/test_internals.py b/Lib/test/test_ctypes/test_internals.py index 778da6573..292633aaa 100644 --- a/Lib/test/test_ctypes/test_internals.py +++ b/Lib/test/test_ctypes/test_internals.py @@ -27,6 +27,8 @@ class ObjectsTestCase(unittest.TestCase): self.assertEqual(refcnt, sys.getrefcount(i)) self.assertEqual(ci._objects, None) + # TODO: RUSTPYTHON + @unittest.expectedFailure def test_c_char_p(self): s = "Hello, World".encode("ascii") refcnt = sys.getrefcount(s) @@ -62,6 +64,8 @@ class ObjectsTestCase(unittest.TestCase): x1.a, x2.b = 42, 93 self.assertEqual(y._objects, {"0": {}, "1": {}}) + # TODO: RUSTPYTHON + @unittest.expectedFailure def test_xxx(self): class X(Structure): _fields_ = [("a", c_char_p), ("b", c_char_p)] diff --git a/Lib/test/test_ctypes/test_keeprefs.py b/Lib/test/test_ctypes/test_keeprefs.py index 23b03b64b..5aa5b86fa 100644 --- a/Lib/test/test_ctypes/test_keeprefs.py +++ b/Lib/test/test_ctypes/test_keeprefs.py @@ -12,6 +12,8 @@ class SimpleTestCase(unittest.TestCase): x = c_int(99) self.assertEqual(x._objects, None) + # TODO: RUSTPYTHON + @unittest.expectedFailure def test_ccharp(self): x = c_char_p() self.assertEqual(x._objects, None) @@ -33,6 +35,8 @@ class StructureTestCase(unittest.TestCase): x.b = 99 self.assertEqual(x._objects, None) + # TODO: RUSTPYTHON + @unittest.expectedFailure def test_ccharp_struct(self): class X(Structure): _fields_ = [("a", c_char_p), diff --git a/Lib/test/test_ctypes/test_objects.py b/Lib/test/test_ctypes/test_objects.py index fb01421b9..8db1cd873 100644 --- a/Lib/test/test_ctypes/test_objects.py +++ b/Lib/test/test_ctypes/test_objects.py @@ -58,7 +58,8 @@ import unittest def load_tests(loader, tests, pattern): - tests.addTest(doctest.DocTestSuite()) + # TODO: RUSTPYTHON - doctest disabled due to null terminator in _objects + # tests.addTest(doctest.DocTestSuite()) return tests diff --git a/Lib/test/test_ctypes/test_python_api.py b/Lib/test/test_ctypes/test_python_api.py index 1072a1098..2e68b35f8 100644 --- a/Lib/test/test_ctypes/test_python_api.py +++ b/Lib/test/test_ctypes/test_python_api.py @@ -7,6 +7,8 @@ from ctypes import (pythonapi, POINTER, create_string_buffer, sizeof, class PythonAPITestCase(unittest.TestCase): + # TODO: RUSTPYTHON + @unittest.expectedFailure def test_PyBytes_FromStringAndSize(self): PyBytes_FromStringAndSize = pythonapi.PyBytes_FromStringAndSize @@ -57,6 +59,8 @@ class PythonAPITestCase(unittest.TestCase): del pyobj self.assertEqual(sys.getrefcount(s), ref) + # TODO: RUSTPYTHON + @unittest.expectedFailure def test_PyOS_snprintf(self): PyOS_snprintf = pythonapi.PyOS_snprintf PyOS_snprintf.argtypes = POINTER(c_char), c_size_t, c_char_p diff --git a/Lib/test/test_ctypes/test_random_things.py b/Lib/test/test_ctypes/test_random_things.py index 630f6ed94..3908eca09 100644 --- a/Lib/test/test_ctypes/test_random_things.py +++ b/Lib/test/test_ctypes/test_random_things.py @@ -70,6 +70,8 @@ class CallbackTracbackTestCase(unittest.TestCase): with self.expect_unraisable(ZeroDivisionError): cb(0.0) + # TODO: RUSTPYTHON + @unittest.expectedFailure def test_TypeErrorDivisionError(self): cb = CFUNCTYPE(c_int, c_char_p)(callback_func) err_msg = "unsupported operand type(s) for /: 'int' and 'bytes'" diff --git a/Lib/test/test_ctypes/test_values.py b/Lib/test/test_ctypes/test_values.py index 1b757e020..e0d200e21 100644 --- a/Lib/test/test_ctypes/test_values.py +++ b/Lib/test/test_ctypes/test_values.py @@ -39,6 +39,8 @@ class ValuesTestCase(unittest.TestCase): class PythonValuesTestCase(unittest.TestCase): """This test only works when python itself is a dll/shared library""" + # TODO: RUSTPYTHON + @unittest.expectedFailure def test_optimizeflag(self): # This test accesses the Py_OptimizeFlag integer, which is # exported by the Python dll and should match the sys.flags value @@ -46,6 +48,8 @@ class PythonValuesTestCase(unittest.TestCase): opt = c_int.in_dll(pythonapi, "Py_OptimizeFlag").value self.assertEqual(opt, sys.flags.optimize) + # TODO: RUSTPYTHON + @unittest.expectedFailure def test_frozentable(self): # Python exports a PyImport_FrozenModules symbol. This is a # pointer to an array of struct _frozen entries. The end of the diff --git a/Lib/test/test_ctypes/test_win32.py b/Lib/test/test_ctypes/test_win32.py index 319191186..4de4f0379 100644 --- a/Lib/test/test_ctypes/test_win32.py +++ b/Lib/test/test_ctypes/test_win32.py @@ -17,6 +17,8 @@ class FunctionCallTestCase(unittest.TestCase): @unittest.skipUnless('MSC' in sys.version, "SEH only supported by MSC") @unittest.skipIf(sys.executable.lower().endswith('_d.exe'), "SEH not enabled in debug builds") + # TODO: RUSTPYTHON - SEH not implemented + @unittest.skipIf("RustPython" in sys.version, "SEH not implemented in RustPython") def test_SEH(self): # Disable faulthandler to prevent logging the warning: # "Windows fatal exception: access violation" diff --git a/Lib/test/test_ctypes/test_win32_com_foreign_func.py b/Lib/test/test_ctypes/test_win32_com_foreign_func.py index 8d217fc17..b12e09333 100644 --- a/Lib/test/test_ctypes/test_win32_com_foreign_func.py +++ b/Lib/test/test_ctypes/test_win32_com_foreign_func.py @@ -158,6 +158,8 @@ class ForeignFunctionsThatWillCallComMethodsTests(unittest.TestCase): self.assertEqual(0, ppst.Release()) + # TODO: RUSTPYTHON - COM iid parameter handling not implemented + @unittest.expectedFailure def test_with_paramflags_and_iid(self): class IUnknown(c_void_p): QueryInterface = proto_query_interface(None, IID_IUnknown) diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 61f4156dc..3db920360 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -430,6 +430,7 @@ class ExceptionTests(unittest.TestCase): @unittest.skipUnless(sys.platform == 'win32', 'test specific to Windows') + @unittest.expectedFailure # TODO: RUSTPYTHON def test_windows_message(self): """Should fill in unknown error code in Windows error message""" ctypes = import_module('ctypes') diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 939315379..bb558524c 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -939,7 +939,6 @@ class UtimeTests(unittest.TestCase): return buf.value # return None if the filesystem is unknown - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; (ModuleNotFoundError: No module named '_ctypes')") def test_large_time(self): # Many filesystems are limited to the year 2038. At least, the test # pass with NTFS filesystem. @@ -2712,12 +2711,10 @@ class Win32KillTests(unittest.TestCase): os.kill(proc.pid, sig) self.assertEqual(proc.wait(), sig) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; (ModuleNotFoundError: No module named '_ctypes')") def test_kill_sigterm(self): # SIGTERM doesn't mean anything special, but make sure it works self._kill(signal.SIGTERM) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; (ModuleNotFoundError: No module named '_ctypes')") def test_kill_int(self): # os.kill on Windows can take an int which gets set as the exit code self._kill(100)