diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 5c1a06530..72d500297 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -853,7 +853,12 @@ class ClassDocumenter(ModuleLevelDocumenter): if initmeth is None or initmeth is object.__init__ or not \ (inspect.ismethod(initmeth) or inspect.isfunction(initmeth)): return None - argspec = inspect.getargspec(initmeth) + try: + argspec = inspect.getargspec(initmeth) + except TypeError: + # still not possible: happens e.g. for old-style classes + # with __init__ in C + return None if argspec[0] and argspec[0][0] in ('cls', 'self'): del argspec[0][0] return inspect.formatargspec(*argspec) diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index d7e2f4efc..8e0114386 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -470,9 +470,10 @@ class Class(Base): #: should be documented -- süß attr = 'bar' - @property def prop(self): """Property.""" + # stay 2.4 compatible (docstring!) + prop = property(prop, doc="Property.") docattr = 'baz' """should likewise be documented -- süß""" diff --git a/tests/test_build.py b/tests/test_build.py index 18c784995..7b33dc095 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -31,8 +31,7 @@ from sphinx.writers.latex import LaTeXTranslator def teardown_module(): - (test_root / '_build').rmtree() - (test_root / 'generated').rmtree() + (test_root / '_build').rmtree(True) html_warnfile = StringIO() diff --git a/tests/test_env.py b/tests/test_env.py index ba0a916ff..a06656d69 100644 --- a/tests/test_env.py +++ b/tests/test_env.py @@ -26,7 +26,6 @@ def setup_module(): def teardown_module(): app.cleanup() - (test_root / 'generated').rmtree() def warning_emitted(file, text): for warning in warnings: diff --git a/tests/test_i18n.py b/tests/test_i18n.py index 61dbef84f..94648727e 100644 --- a/tests/test_i18n.py +++ b/tests/test_i18n.py @@ -11,10 +11,6 @@ from util import * -def teardown_module(): - (test_root / '_build').rmtree() - (test_root / 'generated').rmtree() - @with_app(confoverrides={'language': 'de'}) def test_i18n(app): diff --git a/tests/test_theming.py b/tests/test_theming.py index cf450c02b..349a9ce4a 100644 --- a/tests/test_theming.py +++ b/tests/test_theming.py @@ -16,10 +16,6 @@ from util import * from sphinx.theming import Theme, ThemeError -def teardown_module(): - (test_root / '_build').rmtree() - (test_root / 'generated').rmtree() - @with_app(confoverrides={'html_theme': 'ziptheme', 'html_theme_options.testopt': 'foo'}) diff --git a/tests/util.py b/tests/util.py index 2c9d3176e..4bb6a6538 100644 --- a/tests/util.py +++ b/tests/util.py @@ -105,7 +105,7 @@ class TestApp(application.Sphinx): application.CONFIG_FILENAME = confname - self.cleanup_trees = [] + self.cleanup_trees = [test_root / 'generated'] if srcdir is None: srcdir = test_root