Skip to content

Commit

Permalink
Fix CIs
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Li <[email protected]>
  • Loading branch information
adam2392 committed Dec 15, 2023
1 parent 6fb08c7 commit f56adc7
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions mne_connectivity/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,37 @@
from mne.utils import _check_qt_version


def has_pyvista():
"""Check that PyVista is installed."""
try:
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
import pyvista # noqa: F401
return True
except ImportError:
return False


def has_pyvistaqt():
"""Check that PyVistaQt is installed."""
try:
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
import pyvistaqt # noqa: F401
return True
except ImportError:
return False


def has_imageio_ffmpeg():
"""Check if imageio-ffmpeg is installed."""
try:
import imageio_ffmpeg # noqa: F401

return True
except ImportError:
return False

def pytest_configure(config):
"""Configure pytest options."""
# Fixtures
Expand Down Expand Up @@ -153,12 +184,6 @@ def _use_backend(backend_name, interactive):


def _check_skip_backend(name):
from mne.viz.backends.tests._utils import (
has_imageio_ffmpeg,
has_pyvista,
has_pyvistaqt,
)

if name in ("pyvistaqt", "notebook"):
if not has_pyvista():
pytest.skip("Test skipped, requires pyvista.")
Expand Down

0 comments on commit f56adc7

Please sign in to comment.