14
14
TINY_PAGES = pjoin (HERE , 'tinypages' )
15
15
16
16
17
- def setup ():
18
- # Check we have the sphinx-build command
17
+ def check_sphinx_build ():
18
+ """ Check we have the sphinx-build command"""
19
19
try :
20
20
ret = call (['sphinx-build' , '--help' ], stdout = PIPE , stderr = PIPE )
21
21
except OSError :
@@ -33,10 +33,11 @@ def file_same(file1, file2):
33
33
34
34
35
35
class TestTinyPages (object ):
36
- # Test build and output of tinypages project
36
+ """ Test build and output of tinypages project"""
37
37
38
38
@classmethod
39
39
def setup_class (cls ):
40
+ check_sphinx_build ()
40
41
cls .page_build = tempfile .mkdtemp ()
41
42
try :
42
43
cls .html_dir = pjoin (cls .page_build , 'html' )
@@ -48,14 +49,12 @@ def setup_class(cls):
48
49
cls .html_dir ]
49
50
proc = Popen (cmd , stdout = PIPE , stderr = PIPE )
50
51
out , err = proc .communicate ()
52
+ if proc .returncode != 0 :
53
+ raise RuntimeError ('sphinx-build failed with stdout:\n '
54
+ '{0}\n stderr:\n {1}\n ' .format (out , err ))
51
55
except Exception as e :
52
56
shutil .rmtree (cls .page_build )
53
57
raise e
54
- if proc .returncode != 0 :
55
- shutil .rmtree (cls .page_build )
56
- raise RuntimeError ('sphinx-build failed with stdout:\n '
57
- '{0}\n stderr:\n {1}\n ' .format (
58
- out , err ))
59
58
60
59
@classmethod
61
60
def teardown_class (cls ):
0 commit comments