Skip to content

Commit 364f018

Browse files
QuLogicArchangeGabriel
authored andcommitted
TST: Catch warnings when looking for optional deps.
1 parent 209d1dc commit 364f018

File tree

5 files changed

+35
-17
lines changed

5 files changed

+35
-17
lines changed

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import os
99
import sys
1010
import tempfile
11+
import warnings
1112

1213
import numpy as np
1314
import pytest
@@ -20,9 +21,11 @@
2021
_determinism_check)
2122

2223

23-
needs_usetex = pytest.mark.skipif(
24-
not checkdep_usetex(True),
25-
reason="This test needs a TeX installation")
24+
with warnings.catch_warnings():
25+
warnings.simplefilter('ignore')
26+
needs_usetex = pytest.mark.skipif(
27+
not checkdep_usetex(True),
28+
reason="This test needs a TeX installation")
2629

2730

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

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import io
66
import re
7+
import warnings
78

89
import numpy as np
910
import pytest
@@ -17,12 +18,14 @@
1718
_determinism_check)
1819

1920

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")
21+
with warnings.catch_warnings():
22+
warnings.simplefilter('ignore')
23+
needs_ghostscript = pytest.mark.skipif(
24+
matplotlib.checkdep_ghostscript()[0] is None,
25+
reason="This test needs a ghostscript installation")
26+
needs_usetex = pytest.mark.skipif(
27+
not matplotlib.checkdep_usetex(True),
28+
reason="This test needs a TeX installation")
2629

2730

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

lib/matplotlib/tests/test_backend_svg.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from io import BytesIO
77
import os
88
import tempfile
9+
import warnings
910
import xml.parsers.expat
1011

1112
import pytest
@@ -16,9 +17,11 @@
1617
from matplotlib import dviread
1718

1819

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

2326

2427
def test_visibility():

lib/matplotlib/tests/test_text.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
from matplotlib.testing.decorators import image_comparison
1515

1616

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

2123

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

lib/matplotlib/tests/test_usetex.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import absolute_import, division, print_function
2+
import warnings
23

34
import pytest
45

@@ -7,8 +8,14 @@
78
import matplotlib.pyplot as plt
89

910

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

0 commit comments

Comments
 (0)