File: no_mpl_tests.py

package info (click to toggle)
sphinx-needs 5.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 11,924 kB
  • sloc: python: 21,132; javascript: 187; makefile: 89; sh: 29; xml: 10
file content (27 lines) | stat: -rw-r--r-- 984 bytes parent folder | download
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
"""These tests should only be run in an environment without matplotlib installed."""

import pytest


@pytest.mark.parametrize(
    "test_app",
    [{"buildername": "html", "srcdir": "doc_test/doc_needbar"}],
    indirect=True,
)
def test_needbar(test_app):
    """Test the build fails correctly, if matplotlib is not installed."""
    test_app.build()
    expected = "WARNING: Matplotlib is not installed and required by needbar. Install with `sphinx-needs[plotting]` to use. [needs.mpl]"
    assert expected in test_app._warning.getvalue()


@pytest.mark.parametrize(
    "test_app",
    [{"buildername": "html", "srcdir": "doc_test/doc_needpie"}],
    indirect=True,
)
def test_needpie(test_app):
    """Test the build fails correctly, if matplotlib is not installed."""
    test_app.build()
    expected = "WARNING: Matplotlib is not installed and required by needpie. Install with `sphinx-needs[plotting]` to use. [needs.mpl]"
    assert expected in test_app._warning.getvalue()