Skip to content

Commit 31a5e57

Browse files
authored
Merge pull request #6848 from Kojoley/improve-sphinx-test
TST: pytest compatible module level setup
2 parents f7ff2fa + 54bb09b commit 31a5e57

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/matplotlib/sphinxext/tests/test_tinypages.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
TINY_PAGES = pjoin(HERE, 'tinypages')
1515

1616

17-
def setup():
18-
# Check we have the sphinx-build command
17+
def setup_module():
18+
"""Check we have the sphinx-build command"""
1919
try:
2020
ret = call(['sphinx-build', '--help'], stdout=PIPE, stderr=PIPE)
2121
except OSError:
@@ -33,7 +33,7 @@ def file_same(file1, file2):
3333

3434

3535
class TestTinyPages(object):
36-
# Test build and output of tinypages project
36+
"""Test build and output of tinypages project"""
3737

3838
@classmethod
3939
def setup_class(cls):
@@ -48,14 +48,12 @@ def setup_class(cls):
4848
cls.html_dir]
4949
proc = Popen(cmd, stdout=PIPE, stderr=PIPE)
5050
out, err = proc.communicate()
51+
if proc.returncode != 0:
52+
raise RuntimeError('sphinx-build failed with stdout:\n'
53+
'{0}\nstderr:\n{1}\n'.format(out, err))
5154
except Exception as e:
5255
shutil.rmtree(cls.page_build)
5356
raise e
54-
if proc.returncode != 0:
55-
shutil.rmtree(cls.page_build)
56-
raise RuntimeError('sphinx-build failed with stdout:\n'
57-
'{0}\nstderr:\n{1}\n'.format(
58-
out, err))
5957

6058
@classmethod
6159
def teardown_class(cls):

0 commit comments

Comments
 (0)