Skip to content

Commit d82d0f7

Browse files
committed
TST: Catch warnings when looking for optional deps.
1 parent 46d3860 commit d82d0f7

File tree

5 files changed

+36
-17
lines changed

5 files changed

+36
-17
lines changed

lib/matplotlib/tests/test_backend_pdf.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import sys
44
import tempfile
5+
import warnings
56

67
import numpy as np
78
import pytest
@@ -14,9 +15,11 @@
1415
_determinism_check)
1516

1617

17-
needs_usetex = pytest.mark.skipif(
18-
not checkdep_usetex(True),
19-
reason="This test needs a TeX installation")
18+
with warnings.catch_warnings():
19+
warnings.simplefilter('ignore')
20+
needs_usetex = pytest.mark.skipif(
21+
not checkdep_usetex(True),
22+
reason="This test needs a TeX installation")
2023

2124

2225
@image_comparison(baseline_images=['pdf_use14corefonts'],

lib/matplotlib/tests/test_backend_ps.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pathlib import Path
44
import re
55
import tempfile
6+
import warnings
67

78
import pytest
89

@@ -14,12 +15,14 @@
1415
_determinism_check)
1516

1617

17-
needs_ghostscript = pytest.mark.skipif(
18-
matplotlib.checkdep_ghostscript()[0] is None,
19-
reason="This test needs a ghostscript installation")
20-
needs_usetex = pytest.mark.skipif(
21-
not matplotlib.checkdep_usetex(True),
22-
reason="This test needs a TeX installation")
18+
with warnings.catch_warnings():
19+
warnings.simplefilter('ignore')
20+
needs_ghostscript = pytest.mark.skipif(
21+
matplotlib.checkdep_ghostscript()[0] is None,
22+
reason="This test needs a ghostscript installation")
23+
needs_usetex = pytest.mark.skipif(
24+
not matplotlib.checkdep_usetex(True),
25+
reason="This test needs a TeX installation")
2326

2427

2528
# This tests tends to hit a TeX cache lock on AppVeyor.

lib/matplotlib/tests/test_backend_svg.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from io import BytesIO
33
import os
44
import tempfile
5+
import warnings
56
import xml.parsers.expat
67

78
import pytest
@@ -12,9 +13,11 @@
1213
from matplotlib import dviread
1314

1415

15-
needs_usetex = pytest.mark.skipif(
16-
not matplotlib.checkdep_usetex(True),
17-
reason="This test needs a TeX installation")
16+
with warnings.catch_warnings():
17+
warnings.simplefilter('ignore')
18+
needs_usetex = pytest.mark.skipif(
19+
not matplotlib.checkdep_usetex(True),
20+
reason="This test needs a TeX installation")
1821

1922

2023
def test_visibility():

lib/matplotlib/tests/test_text.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
from matplotlib.testing.decorators import image_comparison
1212

1313

14-
needs_usetex = pytest.mark.skipif(
15-
not matplotlib.checkdep_usetex(True),
16-
reason="This test needs a TeX installation")
14+
with warnings.catch_warnings():
15+
warnings.simplefilter('ignore')
16+
needs_usetex = pytest.mark.skipif(
17+
not matplotlib.checkdep_usetex(True),
18+
reason="This test needs a TeX installation")
1719

1820

1921
@image_comparison(baseline_images=['font_styles'])

lib/matplotlib/tests/test_usetex.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1+
import warnings
2+
13
import pytest
24

35
import matplotlib
46
from matplotlib.testing.decorators import image_comparison
57
import matplotlib.pyplot as plt
68

79

8-
@pytest.mark.skipif(not matplotlib.checkdep_usetex(True),
9-
reason='Missing TeX or Ghostscript or dvipng')
10+
with warnings.catch_warnings():
11+
warnings.simplefilter('ignore')
12+
needs_usetex = pytest.mark.skipif(
13+
not matplotlib.checkdep_usetex(True),
14+
reason='Missing TeX of Ghostscript or dvipng')
15+
16+
17+
@needs_usetex
1018
@image_comparison(baseline_images=['test_usetex'],
1119
extensions=['pdf', 'png'],
1220
tol=0.3)

0 commit comments

Comments
 (0)