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 2 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: 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
6 changes: 6 additions & 0 deletions pyaedt/generic/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
try:
from matplotlib.patches import PathPatch
from matplotlib.path import Path

# Use matplotlib Agg backend (non-interactive) when the CI is running.
if os.getenv("ON_CI", "False") == "True": # pragma: no cover
import matplotlib

matplotlib.use("Agg")
import matplotlib.pyplot as plt

rc_params = {
Expand Down
5 changes: 5 additions & 0 deletions pyaedt/generic/touchstone_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
from pyaedt.misc.misc import installed_versions

if not is_ironpython:
# Use matplotlib Agg backend (non-interactive) when the CI is running.
if os.getenv("ON_CI", "False") == "True": # pragma: no cover
import matplotlib

matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
import skrf as rf
Expand Down
5 changes: 5 additions & 0 deletions pyaedt/modules/solutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
except ImportError:
pv = None
try:
# Use matplotlib Agg backend (non-interactive) when the CI is running.
if os.getenv("ON_CI", "False") == "True": # pragma: no cover
import matplotlib

matplotlib.use("Agg")
import matplotlib.pyplot as plt
except ImportError:
plt = None
Expand Down
Loading