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

Skip to content

Commit cb6ac50

Browse files
committed
Update test for save images in mayavi
1 parent ee040ef commit cb6ac50

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
@@ -236,19 +236,19 @@ def test_thumbnail_number():
236236
assert_equal(thumbnail_number, 2)
237237

238238

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

248-
gallery_conf = {'find_mayavi_figures': True}
247+
gallery_conf = build_test_configuration(find_mayavi_figures=True)
248+
249249
mlab.test_plot3d()
250250
plt.plot(1, 1)
251-
fname_template = os.path.join(examples_dir, 'image{0}.png')
251+
fname_template = os.path.join(gallery_conf['examples_dir'], 'image{0}.png')
252252
fig_list, _ = sg.save_figures(fname_template, 0, gallery_conf)
253253
assert_equal(len(fig_list), 2)
254254
assert fig_list[0].endswith('image1.png')
@@ -261,7 +261,7 @@ def test_save_figures():
261261
assert fig_list[0].endswith('image3.png')
262262
assert fig_list[1].endswith('image4.png')
263263

264-
shutil.rmtree(examples_dir)
264+
shutil.rmtree(gallery_conf['examples_dir'])
265265

266266

267267
def test_zip_notebooks():

0 commit comments

Comments
 (0)