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

Skip to content

Commit 5562a46

Browse files
committed
Check for failed example on last build
plots are current verifies not to find image mark file of broken example to return True. If example has failed in previous builds, then plots are not current and the example is build from start. Fix #105 Fix #94 because first image is no longer overwritten
1 parent 3631b96 commit 5562a46

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sphinx_gallery/gen_rst.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ def _plots_are_current(src_file, image_path):
312312
example"""
313313

314314
has_image = os.path.exists(image_path)
315+
316+
# if example failed on previous builds
317+
broken_img = image_file.format(-1)
318+
if os.path.exists(broken_img):
319+
has_image = False
320+
# to avoid considering example as failed on future builds
321+
os.remove(broken_img)
322+
315323
src_file_changed = check_md5sum_change(src_file)
316324

317325
return has_image and not src_file_changed

0 commit comments

Comments
 (0)