mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Added test for build and made web support buildable without specifying search adapter
This commit is contained in:
47
tests/test_websupport.py
Normal file
47
tests/test_websupport.py
Normal 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()
|
||||
|
||||
Reference in New Issue
Block a user