summaryrefslogtreecommitdiff
path: root/tests/test_websupport.py
diff options
context:
space:
mode:
authorJacob Mason <jacoblmason@gmail.com>2010-07-30 16:13:51 -0500
committerJacob Mason <jacoblmason@gmail.com>2010-07-30 16:13:51 -0500
commit2528f3ddce3209fec1b4910cfbb73d291ac5a25b (patch)
treed6b86b6c9fcb95de5165b33291fbbb9d5547c9ee /tests/test_websupport.py
parent846ab3a74374a1f7e72d5e7a56857beb8eb494f4 (diff)
downloadsphinx-git-2528f3ddce3209fec1b4910cfbb73d291ac5a25b.tar.gz
Added SrcdirNotSpecifiedError
Diffstat (limited to 'tests/test_websupport.py')
-rw-r--r--tests/test_websupport.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/test_websupport.py b/tests/test_websupport.py
index 80a4affed..b8884bf91 100644
--- a/tests/test_websupport.py
+++ b/tests/test_websupport.py
@@ -13,7 +13,7 @@ import os
from StringIO import StringIO
from sphinx.websupport import WebSupport
-from sphinx.websupport.errors import DocumentNotFoundError
+from sphinx.websupport.errors import *
try:
from functools import wraps
@@ -23,13 +23,14 @@ except ImportError:
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'),
+ settings = {'outdir': os.path.join(test_root, 'websupport'),
'status': StringIO(),
'warning': StringIO()}
settings.update(kwargs)
@@ -42,8 +43,20 @@ def with_support(*args, **kwargs):
return new_func
return generator
+
@with_support()
+def test_no_srcdir(support):
+ """Make sure the correct exception is raised if srcdir is not given."""
+ raises(SrcdirNotSpecifiedError, support.build)
+
+@with_support(srcdir=test_root)
def test_build(support):
support.build()
+
+@with_support()
+def test_get_document(support):
raises(DocumentNotFoundError, support.get_document, 'nonexisting')
+ contents = support.get_document('contents')
+ assert contents['title'] and contents['body'] \
+ and contents['sidebar'] and contents['relbar']