Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc319ea

Browse files
committed
Update test for save images in mayavi
1 parent f889510 commit cc319ea

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sphinx_gallery/tests/test_gen_rst.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,19 @@ def test_thumbnail_number():
234234
assert_equal(thumbnail_number, 2)
235235

236236

237-
def test_save_figures():
237+
def test_save_figures_mayavi():
238238
"""Test file naming when saving figures. Requires mayavi."""
239239
try:
240240
from mayavi import mlab
241241
except ImportError:
242242
raise nose.SkipTest('Mayavi not installed')
243243
mlab.options.offscreen = True
244-
examples_dir = tempfile.mkdtemp()
245244

246-
gallery_conf = {'find_mayavi_figures': True}
245+
gallery_conf = build_test_configuration(find_mayavi_figures=True)
246+
247247
mlab.test_plot3d()
248248
plt.plot(1, 1)
249-
fname_template = os.path.join(examples_dir, 'image{0}.png')
249+
fname_template = os.path.join(gallery_conf['examples_dir'], 'image{0}.png')
250250
fig_list, _ = sg.save_figures(fname_template, 0, gallery_conf)
251251
assert_equal(len(fig_list), 2)
252252
assert fig_list[0].endswith('image1.png')
@@ -259,7 +259,7 @@ def test_save_figures():
259259
assert fig_list[0].endswith('image3.png')
260260
assert fig_list[1].endswith('image4.png')
261261

262-
shutil.rmtree(examples_dir)
262+
shutil.rmtree(gallery_conf['examples_dir'])
263263

264264
# TODO: test that broken thumbnail does appear when needed
265265
# TODO: test that examples are not executed twice

0 commit comments

Comments
 (0)