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

CHORE: Use matplotlib Agg backend when testing #4702

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
7 changes: 7 additions & 0 deletions _unittest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import tempfile
import time

import matplotlib
import pytest

from pyaedt.generic.settings import settings
Expand Down Expand Up @@ -219,3 +220,9 @@ def _method(project_name=None, subfolder=""):
)

return _method


@pytest.fixture(autouse=True)
def matplotlib_use_agg():
"""Configure Matplotlib to use 'Agg' backend for all tests."""
matplotlib.use("Agg")
7 changes: 6 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,17 @@ def setup(app):
# Must be less than or equal to the XVFB window size
pyvista.global_theme["window_size"] = np.array([1024, 768])

# suppress annoying matplotlib bug
# Suppress annoying matplotlib bug
warnings.filterwarnings(
"ignore",
category=UserWarning,
message="Matplotlib is currently using agg, which is a non-GUI backend, so it cannot show the figure.",
)
warnings.filterwarnings(
"ignore",
category=UserWarning,
message="FigureCanvasAgg is non-interactive, and thus cannot be shown",
)

extensions.append("sphinx_gallery.gen_gallery")
sphinx_gallery_conf = {
Expand Down
Loading