| 1459 | |
| 1460 | |
| 1461 | def _init_tests(): |
| 1462 | # CPython's faulthandler since v3.6 handles exceptions on Windows |
| 1463 | # https://bugs.python.org/issue23848 but until v3.6.4 it was printing |
| 1464 | # non-fatal exceptions https://bugs.python.org/issue30557 |
| 1465 | import platform |
| 1466 | if not (sys.platform == 'win32' and |
| 1467 | (3, 6) < sys.version_info < (3, 6, 4) and |
| 1468 | platform.python_implementation() == 'CPython'): |
| 1469 | import faulthandler |
| 1470 | faulthandler.enable() |
| 1471 | |
| 1472 | # The version of FreeType to install locally for running the |
| 1473 | # tests. This must match the value in `setupext.py` |
| 1474 | LOCAL_FREETYPE_VERSION = '2.6.1' |
| 1475 | |
| 1476 | from matplotlib import ft2font |
| 1477 | if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or |
| 1478 | ft2font.__freetype_build_type__ != 'local'): |
| 1479 | warnings.warn( |
| 1480 | "Matplotlib is not built with the correct FreeType version to run " |
| 1481 | "tests. Set local_freetype=True in setup.cfg and rebuild. " |
| 1482 | "Expect many image comparison failures below. " |
| 1483 | "Expected freetype version {0}. " |
| 1484 | "Found freetype version {1}. " |
| 1485 | "Freetype build type is {2}local".format( |
| 1486 | LOCAL_FREETYPE_VERSION, |
| 1487 | ft2font.__freetype_version__, |
| 1488 | "" if ft2font.__freetype_build_type__ == 'local' else "not " |
| 1489 | ) |
| 1490 | ) |
| 1491 | |
| 1492 | try: |
| 1493 | import pytest |
| 1494 | except ImportError: |
| 1495 | print("matplotlib.test requires pytest to run.") |
| 1496 | raise |
| 1497 | |
| 1498 | |
| 1499 | def test(verbosity=None, coverage=False, switch_backend_warn=True, |