Skip to content

Commit 446aa88

Browse files
authored
[MNT] set matplotlib backend to Agg in CI to prevent sporadic tkinter errors (#596)
Fixes sporadic `tkinter` errors by setting the `matplotlib` backend to `Agg` in CI. sktime/pytorch-forecasting#1937
1 parent 46ecb75 commit 446aa88

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@
1212

1313
__author__ = ["fkiraly"]
1414

15+
import os
16+
17+
from skbase.utils.dependencies import _check_soft_dependencies
18+
19+
# used to prevent tkinter related errors in CI
20+
if _check_soft_dependencies("matplotlib", severity="none"):
21+
if os.environ.get("GITHUB_ACTIONS") == "true":
22+
import matplotlib
23+
24+
matplotlib.use("Agg")
25+
1526

1627
def pytest_addoption(parser):
1728
"""Pytest command line parser options adder."""

0 commit comments

Comments
 (0)