File: test_plotting_namespace.py

package info (click to toggle)
python-pyvista 0.44.1-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 159,804 kB
  • sloc: python: 72,164; sh: 118; makefile: 68
file content (31 lines) | stat: -rw-r--r-- 1,100 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
28
29
30
31
from __future__ import annotations

import importlib
from pathlib import Path

import pytest

from pyvista.core.errors import PyVistaDeprecationWarning

namespace_data = Path(__file__).parent / 'namespace-plotting.txt'
with namespace_data.open() as f:
    namespace = f.read().splitlines()
    # ignore commented data
    namespace = [n.split(', ')[0] for n in namespace if not n.startswith('#')]


@pytest.mark.parametrize('name', namespace)
def test_plotting_top_namespace(name):
    module = importlib.import_module('pyvista.plotting')
    assert hasattr(module, name)


def test_common_plotting_import_paths():
    # These are `pyvista.plotting.plotting` imports found via search on GitHub
    # across multiple public repositories
    with pytest.warns(PyVistaDeprecationWarning):
        from pyvista.plotting.plotting import _ALL_PLOTTERS  # noqa: F401
    with pytest.warns(PyVistaDeprecationWarning):
        from pyvista.plotting.plotting import BasePlotter  # noqa: F401
    with pytest.warns(PyVistaDeprecationWarning):
        from pyvista.plotting.plotting import Plotter  # noqa: F401