summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2013-11-24 01:35:48 (GMT)
committerLarry Hastings <larry@hastings.org>2013-11-24 01:35:48 (GMT)
commitfcafe433202300bfba33bfe16c7b48489fca59ac (patch)
treed5e799958069e47d149efc6b71d1d8ab1d2d2260
parent3b7b1e533e640f4b0427d61fa442111e6bf16fda (diff)
downloadcpython-fcafe433202300bfba33bfe16c7b48489fca59ac.zip
cpython-fcafe433202300bfba33bfe16c7b48489fca59ac.tar.gz
cpython-fcafe433202300bfba33bfe16c7b48489fca59ac.tar.bz2
Fix inspect.signature tests for builtins when docstrings are compiled out.
-rw-r--r--Lib/test/test_capi.py3
-rw-r--r--Lib/test/test_inspect.py7
2 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index 6f75b77..22c8eb0 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -9,6 +9,7 @@ import sys
import time
import unittest
from test import support
+from test.support import MISSING_C_DOCSTRINGS
try:
import _posixsubprocess
except ImportError:
@@ -109,6 +110,8 @@ class CAPITest(unittest.TestCase):
self.assertRaises(TypeError, _posixsubprocess.fork_exec,
Z(),[b'1'],3,[1, 2],5,6,7,8,9,10,11,12,13,14,15,16,17)
+ @unittest.skipIf(MISSING_C_DOCSTRINGS,
+ "Signature information for builtins requires docstrings")
def test_docstring_signature_parsing(self):
self.assertEqual(_testcapi.no_docstring.__doc__, None)
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 0258d3df..365f592 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -17,6 +17,7 @@ except ImportError:
ThreadPoolExecutor = None
from test.support import run_unittest, TESTFN, DirsOnSysPath
+from test.support import MISSING_C_DOCSTRINGS
from test.script_helper import assert_python_ok, assert_python_failure
from test import inspect_fodder as mod
from test import inspect_fodder2 as mod2
@@ -1579,7 +1580,7 @@ class TestSignatureObject(unittest.TestCase):
('kwargs', ..., int, "var_keyword")),
...))
- def test_signature_on_builtin_function(self):
+ def test_signature_on_unsupported_builtins(self):
with self.assertRaisesRegex(ValueError, 'not supported by signature'):
inspect.signature(type)
with self.assertRaisesRegex(ValueError, 'not supported by signature'):
@@ -1588,6 +1589,10 @@ class TestSignatureObject(unittest.TestCase):
with self.assertRaisesRegex(ValueError, 'not supported by signature'):
# support for 'method-wrapper'
inspect.signature(min.__call__)
+
+ @unittest.skipIf(MISSING_C_DOCSTRINGS,
+ "Signature information for builtins requires docstrings")
+ def test_signature_on_builtins(self):
self.assertEqual(inspect.signature(min), None)
signature = inspect.signature(os.stat)
self.assertTrue(isinstance(signature, inspect.Signature))