Disabling autodoc_docstring_signature causes unrelated tests to fail

Nikolaus Rath avatarNikolaus 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.


    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
  File "/home/nikratio/tmp/sphinx/tests/test_autodoc.py", line 486, in
    assert_processes([('function', 'time.asctime')], 'function', 'asctime')
  File "/home/nikratio/tmp/sphinx/tests/test_autodoc.py", line 351, in
    assert_works(objtype, name, **kw)
  File "/home/nikratio/tmp/sphinx/tests/test_autodoc.py", line 345, in
    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 (2)

  1. Nikolaus Rath

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

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

    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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.