def _check_skip_backend(name): from mne.viz.backends.tests._utils import has_mayavi, has_pyvista if name == 'mayavi': if not has_mayavi(): pytest.skip("Test skipped, requires mayavi.") elif name == 'pyvista': if not has_pyvista(): pytest.skip("Test skipped, requires pyvista.")
def backends_3d(backend_name): from mne.viz.backends.renderer import _use_test_3d_backend from mne.viz.backends.tests._utils import has_mayavi, has_vtki if backend_name == 'mayavi': if not has_mayavi(): pytest.skip("Test skipped, requires mayavi.") elif backend_name == 'vtki': if not has_vtki(): pytest.skip("Test skipped, requires vtki.") with _use_test_3d_backend(backend_name): yield
def pixel_ratio(): """Get the pixel ratio.""" from mne.viz.backends.tests._utils import (has_mayavi, has_pyvista, has_pyqt5) if not (has_mayavi() or has_pyvista()) or not has_pyqt5(): return 1. from PyQt5.QtWidgets import QApplication, QMainWindow _ = QApplication.instance() or QApplication([]) window = QMainWindow() ratio = float(window.devicePixelRatio()) window.close() return ratio
def backends_3d(backend_name): """Yield the 3D backends.""" from mne.viz.backends.renderer import _use_test_3d_backend from mne.viz.backends.tests._utils import has_mayavi, has_pyvista if backend_name == 'mayavi': if not has_mayavi(): pytest.skip("Test skipped, requires mayavi.") elif backend_name == 'pyvista': if not has_pyvista(): pytest.skip("Test skipped, requires pyvista.") with _use_test_3d_backend(backend_name): yield
def _check_skip_backend(name): from mne.viz.backends.tests._utils import (has_mayavi, has_pyvista, has_pyqt5, has_imageio_ffmpeg) if name == 'mayavi': if not has_mayavi(): pytest.skip("Test skipped, requires mayavi.") elif name == 'pyvista': if not has_pyvista(): pytest.skip("Test skipped, requires pyvista.") if not has_imageio_ffmpeg(): pytest.skip("Test skipped, requires imageio-ffmpeg") if not has_pyqt5(): pytest.skip("Test skipped, requires PyQt5.")
def _check_skip_backend(name): from mne.viz.backends.tests._utils import (has_mayavi, has_pyvista, has_pyqt5, has_imageio_ffmpeg, has_pyvistaqt) if name in ('pyvistaqt', 'notebook'): if not has_pyvista(): pytest.skip("Test skipped, requires pyvista.") if not has_imageio_ffmpeg(): pytest.skip("Test skipped, requires imageio-ffmpeg") if name in ('pyvistaqt', 'mayavi') and not has_pyqt5(): pytest.skip("Test skipped, requires PyQt5.") if name == 'mayavi' and not has_mayavi(): pytest.skip("Test skipped, requires mayavi.") if name == 'pyvistaqt' and not has_pyvistaqt(): pytest.skip("Test skipped, requires pyvistaqt")