File: _markers.py

package info (click to toggle)
matplotlib 3.10.7%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 72,816 kB
  • sloc: python: 147,545; cpp: 62,988; objc: 1,679; ansic: 1,426; javascript: 788; makefile: 92; sh: 53
file content (49 lines) | stat: -rw-r--r-- 1,419 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""
pytest markers for the internal Matplotlib test suite.
"""

import logging
import shutil

import pytest

import matplotlib.testing
import matplotlib.testing.compare
from matplotlib import _get_executable_info, ExecutableNotFoundError


_log = logging.getLogger(__name__)


def _checkdep_usetex() -> bool:
    if not shutil.which("tex"):
        _log.warning("usetex mode requires TeX.")
        return False
    try:
        _get_executable_info("dvipng")
    except ExecutableNotFoundError:
        _log.warning("usetex mode requires dvipng.")
        return False
    try:
        _get_executable_info("gs")
    except ExecutableNotFoundError:
        _log.warning("usetex mode requires ghostscript.")
        return False
    return True


needs_ghostscript = pytest.mark.skipif(
    "eps" not in matplotlib.testing.compare.converter,
    reason="This test needs a ghostscript installation")
needs_pgf_lualatex = pytest.mark.skipif(
    not matplotlib.testing._check_for_pgf('lualatex'),
    reason='lualatex + pgf is required')
needs_pgf_pdflatex = pytest.mark.skipif(
    not matplotlib.testing._check_for_pgf('pdflatex'),
    reason='pdflatex + pgf is required')
needs_pgf_xelatex = pytest.mark.skipif(
    not matplotlib.testing._check_for_pgf('xelatex'),
    reason='xelatex + pgf is required')
needs_usetex = pytest.mark.skipif(
    not _checkdep_usetex(),
    reason="This test needs a TeX installation")