Skip to content

Commit 4515c61

Browse files
committed
mark more tests
1 parent 9e22580 commit 4515c61

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

Lib/test/support/__init__.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -840,11 +840,27 @@ def python_is_optimized():
840840
return final_opt not in ('', '-O0', '-Og')
841841

842842

843-
_header = 'nP'
843+
# From CPython 3.13.5
844+
Py_GIL_DISABLED = bool(sysconfig.get_config_var('Py_GIL_DISABLED'))
845+
846+
# From CPython 3.13.5
847+
def requires_gil_enabled(msg="needs the GIL enabled"):
848+
"""Decorator for skipping tests on the free-threaded build."""
849+
return unittest.skipIf(Py_GIL_DISABLED, msg)
850+
851+
# From CPython 3.13.5
852+
def expected_failure_if_gil_disabled():
853+
"""Expect test failure if the GIL is disabled."""
854+
if Py_GIL_DISABLED:
855+
return unittest.expectedFailure
856+
return lambda test_case: test_case
857+
858+
# From CPython 3.13.5
859+
if Py_GIL_DISABLED:
860+
_header = 'PHBBInP'
861+
else:
862+
_header = 'nP'
844863
_align = '0n'
845-
if hasattr(sys, "getobjects"):
846-
_header = '2P' + _header
847-
_align = '0P'
848864
_vheader = _header + 'n'
849865

850866
def calcobjsize(fmt):

Lib/test/test_traceback.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ def test_format_exception_group_syntax_error_with_custom_values(self):
430430
self.assertEqual(len(err), 1)
431431
self.assertEqual(err[-1], 'SyntaxError: error\n')
432432

433+
# TODO: RUSTPYTHON; IndexError: index out of range
434+
@unittest.expectedFailure
433435
@requires_subprocess()
434436
@force_not_colorized
435437
def test_encoded_file(self):

0 commit comments

Comments
 (0)