Skip to content

Commit

Permalink
Skip more tests
Browse files Browse the repository at this point in the history
- Lib/test/support/__init__.py
- Lib/test/test_audit.py
- Lib/test/test_gdb/test_misc.py
- Lib/test/test_inspect/test_inspect.py
- Lib/test/test_pydoc/test_pydoc.py
  • Loading branch information
erlend-aasland committed Mar 4, 2024
1 parent 9b3f0f7 commit 0f6f74e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions Lib/test/support/__init__.py
Expand Up @@ -1698,6 +1698,7 @@ def patch_list(orig):
orig[:] = saved


@requires_limited_api
def run_in_subinterp(code):
"""
Run code in a subinterpreter. Raise unittest.SkipTest if the tracemalloc
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_audit.py
Expand Up @@ -7,6 +7,7 @@
from test import support
from test.support import import_helper
from test.support import os_helper
from test.support import requires_limited_api


if not hasattr(sys, "addaudithook") or not hasattr(sys, "audit"):
Expand Down Expand Up @@ -88,6 +89,7 @@ def test_excepthook(self):
[("sys.excepthook", " ", "RuntimeError('fatal-error')")], events
)

@requires_limited_api
def test_unraisablehook(self):
returncode, events, stderr = self.run_python("test_unraisablehook")
if returncode:
Expand Down
6 changes: 5 additions & 1 deletion Lib/test/test_gdb/test_misc.py
@@ -1,6 +1,6 @@
import re
import unittest
from test.support import python_is_optimized
from test.support import python_is_optimized, requires_limited_api

from .util import run_gdb, setup_module, DebuggerTests, SAMPLE_SCRIPT

Expand Down Expand Up @@ -85,6 +85,7 @@ def baz(*args):


class StackNavigationTests(DebuggerTests):
@requires_limited_api
@unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
@unittest.skipIf(python_is_optimized(),
"Python was compiled with optimizations")
Expand Down Expand Up @@ -114,6 +115,7 @@ def test_up_at_top(self):
self.assertEndsWith(bt,
'Unable to find an older python frame\n')

@requires_limited_api
@unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
@unittest.skipIf(python_is_optimized(),
"Python was compiled with optimizations")
Expand All @@ -129,6 +131,7 @@ def test_up_then_down(self):
$''')

class PyPrintTests(DebuggerTests):
@requires_limited_api
@unittest.skipIf(python_is_optimized(),
"Python was compiled with optimizations")
def test_basic_command(self):
Expand All @@ -138,6 +141,7 @@ def test_basic_command(self):
self.assertMultilineMatches(bt,
r".*\nlocal 'args' = \(1, 2, 3\)\n.*")

@requires_limited_api
@unittest.skipIf(python_is_optimized(),
"Python was compiled with optimizations")
@unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
Expand Down
12 changes: 10 additions & 2 deletions Lib/test/test_inspect/test_inspect.py
Expand Up @@ -32,7 +32,7 @@
except ImportError:
ThreadPoolExecutor = None

from test.support import cpython_only
from test.support import cpython_only, requires_limited_api
from test.support import MISSING_C_DOCSTRINGS, ALWAYS_EQ
from test.support.import_helper import DirsOnSysPath, ready_to_import
from test.support.os_helper import TESTFN
Expand Down Expand Up @@ -668,7 +668,10 @@ def test_cleandoc(self):

@cpython_only
def test_c_cleandoc(self):
import _testinternalcapi
try:
import _testinternalcapi
except ImportError:
return unittest.skip("requires _testinternalcapi")
func = _testinternalcapi.compiler_cleandoc
for i, (input, expected) in enumerate(self.cleandoc_testdata):
with self.subTest(i=i):
Expand Down Expand Up @@ -1200,6 +1203,7 @@ def test_getfullargspec_builtin_methods(self):
@cpython_only
@unittest.skipIf(MISSING_C_DOCSTRINGS,
"Signature information for builtins requires docstrings")
@requires_limited_api
def test_getfullargspec_builtin_func(self):
import _testcapi
builtin = _testcapi.docstring_with_signature_with_defaults
Expand All @@ -1209,6 +1213,7 @@ def test_getfullargspec_builtin_func(self):
@cpython_only
@unittest.skipIf(MISSING_C_DOCSTRINGS,
"Signature information for builtins requires docstrings")
@requires_limited_api
def test_getfullargspec_builtin_func_no_signature(self):
import _testcapi
builtin = _testcapi.docstring_no_signature
Expand Down Expand Up @@ -2870,6 +2875,7 @@ def test_staticmethod(*args): # NOQA
@cpython_only
@unittest.skipIf(MISSING_C_DOCSTRINGS,
"Signature information for builtins requires docstrings")
@requires_limited_api
def test_signature_on_builtins(self):
import _testcapi

Expand Down Expand Up @@ -2951,6 +2957,7 @@ class ThisWorksNow:
@cpython_only
@unittest.skipIf(MISSING_C_DOCSTRINGS,
"Signature information for builtins requires docstrings")
@requires_limited_api
def test_signature_on_decorated_builtins(self):
import _testcapi
func = _testcapi.docstring_with_signature_with_defaults
Expand All @@ -2972,6 +2979,7 @@ def wrapper_like(*args, **kwargs) -> int: pass
inspect.signature(wrapper_like))

@cpython_only
@requires_limited_api
def test_signature_on_builtins_no_signature(self):
import _testcapi
with self.assertRaisesRegex(ValueError,
Expand Down
6 changes: 6 additions & 0 deletions Lib/test/test_pydoc/test_pydoc.py
Expand Up @@ -1371,6 +1371,7 @@ def test_bound_builtin_classmethod_o(self):

@support.cpython_only
@requires_docstrings
@support.requires_limited_api
def test_module_level_callable_unrepresentable_default(self):
import _testcapi
builtin = _testcapi.func_with_unrepresentable_signature
Expand All @@ -1379,6 +1380,7 @@ def test_module_level_callable_unrepresentable_default(self):

@support.cpython_only
@requires_docstrings
@support.requires_limited_api
def test_builtin_staticmethod_unrepresentable_default(self):
self.assertEqual(self._get_summary_line(str.maketrans),
"maketrans(x, y=<unrepresentable>, z=<unrepresentable>, /)")
Expand All @@ -1389,6 +1391,7 @@ def test_builtin_staticmethod_unrepresentable_default(self):

@support.cpython_only
@requires_docstrings
@support.requires_limited_api
def test_unbound_builtin_method_unrepresentable_default(self):
self.assertEqual(self._get_summary_line(dict.pop),
"pop(self, key, default=<unrepresentable>, /) "
Expand All @@ -1401,6 +1404,7 @@ def test_unbound_builtin_method_unrepresentable_default(self):

@support.cpython_only
@requires_docstrings
@support.requires_limited_api
def test_bound_builtin_method_unrepresentable_default(self):
self.assertEqual(self._get_summary_line({}.pop),
"pop(key, default=<unrepresentable>, /) "
Expand All @@ -1413,6 +1417,7 @@ def test_bound_builtin_method_unrepresentable_default(self):

@support.cpython_only
@requires_docstrings
@support.requires_limited_api
def test_unbound_builtin_classmethod_unrepresentable_default(self):
import _testcapi
cls = _testcapi.DocStringUnrepresentableSignatureTest
Expand All @@ -1423,6 +1428,7 @@ def test_unbound_builtin_classmethod_unrepresentable_default(self):

@support.cpython_only
@requires_docstrings
@support.requires_limited_api
def test_bound_builtin_classmethod_unrepresentable_default(self):
import _testcapi
cls = _testcapi.DocStringUnrepresentableSignatureTest
Expand Down

0 comments on commit 0f6f74e

Please sign in to comment.