Skip to content
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

Ignore MPL cache warnings #1362

Merged
merged 1 commit into from
May 14, 2024
Merged
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
10 changes: 8 additions & 2 deletions scripts/nb-tester/qiskit_docs_notebook_tester/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@
from qiskit_ibm_runtime import QiskitRuntimeService
from squeaky import clean_notebook

# If not submitting jobs, we mock the real backend by prepending this to each notebook
MOCKING_CODE = """\
# We always run the following code in the kernel before running the notebook
PRE_EXECUTE_CODE = """\
import warnings
warnings.filterwarnings("ignore", message="Matplotlib is building the font cache; this may take a moment.")
"""

# If not submitting jobs, we also run this code before notebook execution to mock the real backend
MOCKING_CODE = """\
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit.providers.fake_provider import GenericBackendV2

Expand Down Expand Up @@ -235,6 +240,7 @@ async def _execute_notebook(filepath: Path, config: Config) -> nbformat.Notebook
extra_arguments=["--InlineBackend.figure_format='svg'"],
)

kernel.execute(PRE_EXECUTE_CODE, store_history=False)
if config.should_patch(filepath):
kernel.execute(MOCKING_CODE, store_history=False)

Expand Down
Loading