Issues

Issue #718 resolved

Disabling autodoc_docstring_signature causes unrelated tests to fail

Nikolaus Rath
created an issue

When trying to backport the autodoc_docstring_signature feature, I noticed that there are unexpected issues when running the sphinx unit tests when autodoc_docstring_signature is False.

Change

{{{ app.add_config_value('autodoc_docstring_signature', True, True) }}}

in sphinx/ext/autodoc.py to

{{{ app.add_config_value('autodoc_docstring_signature', False, True) }}}

to get

{{{

FAIL: test_autodoc.test_generate

Traceback (most recent call last): File "/usr/lib/pymodules/python2.6/nose/case.py", line 187, in runTest self.test(self.arg) File "/home/nikratio/tmp/sphinx/tests/test_autodoc.py", line 486, in test_generate assert_processes([('function', 'time.asctime')], 'function', 'asctime') File "/home/nikratio/tmp/sphinx/tests/test_autodoc.py", line 351, in assert_processes assert_works(objtype, name, *kw) File "/home/nikratio/tmp/sphinx/tests/test_autodoc.py", line 345, in assert_works assert len(_warnings) == 0, _warnings AssertionError: ["error while formatting arguments for time.asctime: <method-wrapper 'init' of builtin_function_or_method object at 0x7f1f5b049a28> is not a Python function"]


}}}

Comments (3)

  1. Nikolaus Rath reporter

    Jakub Wilk suggested that line 915 of sphinx/ext/autodoc.py looks very fishy:

            if inspect.isbuiltin(self.object) or \
                   inspect.ismethoddescriptor(self.object):
                # cannot introspect arguments of a C function or method
                pass
    

    and indeed, replacing `pass` by `return` fixes the problem. Note, however, that I have no idea what's going on here exactly. I just blindly changed this and noticed that all the unit tests work fine after that.

  2. Log in to comment