8000 Apply md5 check to expected_failing examples by mchaaler · Pull Request #937 · sphinx-gallery/sphinx-gallery · GitHub
[go: up one dir, main page]

Skip to content

Apply md5 check to expected_failing examples #937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions sphinx_gallery/gen_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ def _complete_gallery_conf(sphinx_gallery_conf, src_dir, plot_gallery,
gallery_conf['src_dir'] = src_dir
gallery_conf['app'] = app

# Resolve expected_failing_examples paths
gallery_conf['expected_failing_examples'] = set(
os.path.normpath(os.path.join(gallery_conf['src_dir'], path))
for path in gallery_conf['expected_failing_examples'])

# Check capture_repr
capture_repr = gallery_conf['capture_repr']
supported_reprs = ['__repr__', '__str__', '_repr_html_']
Expand Down Expand Up @@ -722,16 +727,10 @@ def touch_empty_backreferences(app, what, name, obj, options, lines):
open(examples_path, 'w').close()


def _expected_failing_examples(gallery_conf):
return set(
os.path.normpath(os.path.join(gallery_conf['src_dir'], path))
for path in gallery_conf['expected_failing_examples'])


def _parse_failures(gallery_conf):
"""Split the failures."""
failing_examples = set(gallery_conf['failing_examples'].keys())
expected_failing_examples = _expected_failing_examples(gallery_conf)
expected_failing_examples = gallery_conf['expected_failing_examples']
failing_as_expected = failing_examples.intersection(
expected_failing_examples)
failing_unexpectedly = failing_examples.difference(
Expand Down
7 changes: 4 additions & 3 deletions sphinx_gallery/gen_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ def generate_dir_rst(src_dir, target_dir, gallery_conf, seen_backrefs):

def handle_exception(exc_info, src_file, script_vars, gallery_conf):
"""Trim and format exception, maybe raise error, etc."""
from .gen_gallery import _expected_failing_examples
etype, exc, tb = exc_info
stack = traceback.extract_tb(tb)
# The full traceback will look something like:
Expand Down Expand Up @@ -495,7 +494,7 @@ def handle_exception(exc_info, src_file, script_vars, gallery_conf):
traceback.format_list(stack) +
traceback.format_exception_only(etype, exc))

expected = src_file in _expected_failing_examples(gallery_conf)
expected = src_file in gallery_conf['expected_failing_examples']
if expected:
func, color = logger.info, 'blue',
else:
Expand All @@ -510,7 +509,7 @@ def handle_exception(exc_info, src_file, script_vars, gallery_conf):
raise
# Stores failing file
gallery_conf['failing_examples'][src_file] = formatted_exception
script_vars['execute_script'] = False
# script_vars['execute_script'] = False

# Ensure it's marked as our style
except_rst = ".. rst-class:: sphx-glr-script-out\n\n" + except_rst
Expand Down Expand Up @@ -966,6 +965,8 @@ def generate_file_rst(fname, target_dir, src_dir, gallery_conf,
do_return = False
else:
gallery_conf['stale_examples'].append(target_file)
if src_file in gallery_conf['expected_failing_examples']:
gallery_conf['expected_failing_examples'].remove(src_file)
if do_return:
return intro, title, (0, 0)

Expand Down
0