2010-01-02 07:59:27 -06:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
test_doctest
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Test the doctest extension.
|
|
|
|
|
2014-03-01 01:18:16 -06:00
|
|
|
:copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
|
2010-01-02 07:59:27 -06:00
|
|
|
:license: BSD, see LICENSE for details.
|
|
|
|
"""
|
2014-04-28 21:46:47 -05:00
|
|
|
|
2013-04-01 04:39:32 -05:00
|
|
|
from util import with_app
|
|
|
|
|
2011-01-03 14:20:29 -06:00
|
|
|
cleanup_called = 0
|
2010-01-02 07:59:27 -06:00
|
|
|
|
2014-09-21 10:17:02 -05:00
|
|
|
|
|
|
|
@with_app(buildername='doctest', testroot='doctest')
|
|
|
|
def test_build(app, status, warning):
|
2011-01-03 14:20:29 -06:00
|
|
|
global cleanup_called
|
|
|
|
cleanup_called = 0
|
2010-01-02 07:59:27 -06:00
|
|
|
app.builder.build_all()
|
|
|
|
if app.statuscode != 0:
|
2014-09-21 10:17:02 -05:00
|
|
|
assert False, 'failures in doctests:' + status.getvalue()
|
2011-01-03 14:20:29 -06:00
|
|
|
# in doctest.txt, there are two named groups and the default group,
|
|
|
|
# so the cleanup function must be called three times
|
|
|
|
assert cleanup_called == 3, 'testcleanup did not get executed enough times'
|
|
|
|
|
2014-09-21 10:17:02 -05:00
|
|
|
|
2011-01-03 14:20:29 -06:00
|
|
|
def cleanup_call():
|
|
|
|
global cleanup_called
|
|
|
|
cleanup_called += 1
|