Skip to content

Commit eaa05d1

Browse files
committed
cleanup tests with plot
1 parent 49af122 commit eaa05d1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/test_plot.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@
55
# License: MIT License
66

77
import numpy as np
8-
import matplotlib
9-
matplotlib.use('Agg')
8+
import pytest
109

1110

11+
try: # test if matplotlib is installed
12+
import matplotlib
13+
matplotlib.use('Agg')
14+
nogo = False
15+
except ImportError:
16+
nogo = True
17+
18+
19+
@pytest.mark.skipif(nogo, reason="Matplotlib not installed")
1220
def test_plot1D_mat():
1321

1422
import ot
@@ -30,6 +38,7 @@ def test_plot1D_mat():
3038
ot.plot.plot1D_mat(a, b, M, 'Cost matrix M')
3139

3240

41+
@pytest.mark.skipif(nogo, reason="Matplotlib not installed")
3342
def test_plot2D_samples_mat():
3443

3544
import ot

0 commit comments

Comments
 (0)