Skip to content

Commit b0f1236

Browse files
authored
Switch to matplotlib agg backend for tests (#101)
Should fix somewhat randomly occurring matplotlib/tk failures
1 parent baa8dfa commit b0f1236

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

tests/test_visualization.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import subprocess
22
import warnings
33
from os import path
4-
from tempfile import TemporaryDirectory
54
from pathlib import Path
5+
from tempfile import TemporaryDirectory
6+
67
import matplotlib.pyplot as plt
78
import pytest
89
from petab.C import *
910
from petab.visualize import (plot_data_and_simulation,
1011
plot_measurements_by_observable,
1112
save_vis_spec)
1213

14+
# Avoid errors when plotting without X server
15+
plt.switch_backend('agg')
16+
1317

1418
@pytest.fixture
1519
def data_file_Fujita():

tests/test_visualization_new_structure.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
from os import path
22
from tempfile import TemporaryDirectory
3+
4+
import matplotlib.pyplot as plt
35
import pytest
46
from petab.C import *
57
from petab.visualize import plot_with_vis_spec, plot_without_vis_spec
68
from petab.visualize.plotting import VisSpecParser
79

10+
# Avoid errors when plotting without X server
11+
plt.switch_backend('agg')
12+
813

914
@pytest.fixture
1015
def data_file_Fujita():

0 commit comments

Comments
 (0)