mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
48 lines
1.1 KiB
Python
48 lines
1.1 KiB
Python
|
# -*- 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()
|
||
|
|