Currently we run examples once with sphinx gallery and once with test-examples. This is mainly done to ensure our coverage is rightly reported.
However, in practice the 2 can be done together.
A simple case:
import os
import coverage
# Start coverage collection
cov = coverage.Coverage()
cov.start()
# Sphinx configuration
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx_gallery.gen_gallery',
]
# Sphinx Gallery configuration
sphinx_gallery_conf = {
'examples_dirs': 'examples', # path to your example scripts
'gallery_dirs': 'auto_examples', # path where to save gallery generated output
'filename_pattern': r'\.py',
'run_stale_examples': True, # Execute all examples even if they haven't changed
}
# Add a build-finished event to stop coverage and generate a report
def coverage_report(app, exception):
cov.stop()
cov.save()
print("\nCoverage Summary:\n")
cov.report()
def setup(app):
app.connect('build-finished', coverage_report)
However, this is not trivial when we run examples in parallel. Some attempts was done in #181 but spawing an issue to track it separately,.
Currently we run examples once with sphinx gallery and once with test-examples. This is mainly done to ensure our coverage is rightly reported. However, in practice the 2 can be done together.
A simple case:
However, this is not trivial when we run examples in parallel. Some attempts was done in #181 but spawing an issue to track it separately,.