Skip to content

Commit

Permalink
CHORE: Update conftest to avoid 'ON_CI'
Browse files Browse the repository at this point in the history
  • Loading branch information
SMoraisAnsys committed May 22, 2024
1 parent b3d9aa7 commit 40e6e10
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
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")
6 changes: 0 additions & 6 deletions pyaedt/generic/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@
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: 0 additions & 5 deletions pyaedt/generic/touchstone_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
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: 0 additions & 5 deletions pyaedt/modules/solutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@
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

0 comments on commit 40e6e10

Please sign in to comment.