Added test for build and made web support buildable without specifying search adapter

This commit is contained in:
Jacob Mason
2010-07-30 11:20:43 -05:00
parent 0039b09a36
commit f014641405
4 changed files with 85 additions and 10 deletions

47
tests/test_websupport.py Normal file
View File

@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
"""
test_websupport
~~~~~~~~~~~~~~~
Test the Web Support Package
:copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
from StringIO import StringIO
from sphinx.websupport import WebSupport
try:
from functools import wraps
except ImportError:
# functools is new in 2.4
wraps = lambda f: (lambda w: w)
from util import *
def teardown_module():
(test_root / 'websupport').rmtree(True)
def with_support(*args, **kwargs):
"""Make a WebSupport object and pass it the test."""
settings = {'srcdir': test_root,
'outdir': os.path.join(test_root, 'websupport'),
'status': StringIO(),
'warning': StringIO()}
settings.update(kwargs)
def generator(func):
@wraps(func)
def new_func(*args2, **kwargs2):
support = WebSupport(**settings)
func(support, *args2, **kwargs2)
return new_func
return generator
@with_support()
def test_build(support):
support.build()