Restore 2.4 compatibility and fix removing the generated file properly.

This commit is contained in:
Georg Brandl 2009-03-16 23:46:58 +01:00
parent ef98b65f29
commit 1878c02078
7 changed files with 10 additions and 14 deletions

View File

@ -853,7 +853,12 @@ class ClassDocumenter(ModuleLevelDocumenter):
if initmeth is None or initmeth is object.__init__ or not \ if initmeth is None or initmeth is object.__init__ or not \
(inspect.ismethod(initmeth) or inspect.isfunction(initmeth)): (inspect.ismethod(initmeth) or inspect.isfunction(initmeth)):
return None return None
try:
argspec = inspect.getargspec(initmeth) 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'): if argspec[0] and argspec[0][0] in ('cls', 'self'):
del argspec[0][0] del argspec[0][0]
return inspect.formatargspec(*argspec) return inspect.formatargspec(*argspec)

View File

@ -470,9 +470,10 @@ class Class(Base):
#: should be documented -- süß #: should be documented -- süß
attr = 'bar' attr = 'bar'
@property
def prop(self): def prop(self):
"""Property.""" """Property."""
# stay 2.4 compatible (docstring!)
prop = property(prop, doc="Property.")
docattr = 'baz' docattr = 'baz'
"""should likewise be documented -- süß""" """should likewise be documented -- süß"""

View File

@ -31,8 +31,7 @@ from sphinx.writers.latex import LaTeXTranslator
def teardown_module(): def teardown_module():
(test_root / '_build').rmtree() (test_root / '_build').rmtree(True)
(test_root / 'generated').rmtree()
html_warnfile = StringIO() html_warnfile = StringIO()

View File

@ -26,7 +26,6 @@ def setup_module():
def teardown_module(): def teardown_module():
app.cleanup() app.cleanup()
(test_root / 'generated').rmtree()
def warning_emitted(file, text): def warning_emitted(file, text):
for warning in warnings: for warning in warnings:

View File

@ -11,10 +11,6 @@
from util import * from util import *
def teardown_module():
(test_root / '_build').rmtree()
(test_root / 'generated').rmtree()
@with_app(confoverrides={'language': 'de'}) @with_app(confoverrides={'language': 'de'})
def test_i18n(app): def test_i18n(app):

View File

@ -16,10 +16,6 @@ from util import *
from sphinx.theming import Theme, ThemeError from sphinx.theming import Theme, ThemeError
def teardown_module():
(test_root / '_build').rmtree()
(test_root / 'generated').rmtree()
@with_app(confoverrides={'html_theme': 'ziptheme', @with_app(confoverrides={'html_theme': 'ziptheme',
'html_theme_options.testopt': 'foo'}) 'html_theme_options.testopt': 'foo'})

View File

@ -105,7 +105,7 @@ class TestApp(application.Sphinx):
application.CONFIG_FILENAME = confname application.CONFIG_FILENAME = confname
self.cleanup_trees = [] self.cleanup_trees = [test_root / 'generated']
if srcdir is None: if srcdir is None:
srcdir = test_root srcdir = test_root