Skip to content
Prev Previous commit
mark more tests
  • Loading branch information
ShaharNaveh committed Jul 16, 2025
commit 4515c614bfa3bb51f535f71ee44b951af52db5c4
24 changes: 20 additions & 4 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,11 +840,27 @@ def python_is_optimized():
return final_opt not in ('', '-O0', '-Og')


_header = 'nP'
# From CPython 3.13.5
Py_GIL_DISABLED = bool(sysconfig.get_config_var('Py_GIL_DISABLED'))

# From CPython 3.13.5
def requires_gil_enabled(msg="needs the GIL enabled"):
"""Decorator for skipping tests on the free-threaded build."""
return unittest.skipIf(Py_GIL_DISABLED, msg)

# From CPython 3.13.5
def expected_failure_if_gil_disabled():
"""Expect test failure if the GIL is disabled."""
if Py_GIL_DISABLED:
return unittest.expectedFailure
return lambda test_case: test_case

# From CPython 3.13.5
if Py_GIL_DISABLED:
_header = 'PHBBInP'
else:
_header = 'nP'
_align = '0n'
if hasattr(sys, "getobjects"):
_header = '2P' + _header
_align = '0P'
_vheader = _header + 'n'

def calcobjsize(fmt):
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ def test_format_exception_group_syntax_error_with_custom_values(self):
self.assertEqual(len(err), 1)
self.assertEqual(err[-1], 'SyntaxError: error\n')

# TODO: RUSTPYTHON; IndexError: index out of range
@unittest.expectedFailure
@requires_subprocess()
@force_not_colorized
def test_encoded_file(self):
Expand Down
Loading