Skip to content

Commit

Permalink
[REF] refactor test surface plotting (nilearn#4966)
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau authored Dec 23, 2024
1 parent 0e4a56a commit fadf7ff
Show file tree
Hide file tree
Showing 2 changed files with 255 additions and 254 deletions.
35 changes: 35 additions & 0 deletions nilearn/plotting/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import pytest


@pytest.fixture(scope="function")
def pyplot():
"""Set up and teardown fixture for matplotlib.
This fixture checks if we can import matplotlib. If not, the tests will be
skipped. Otherwise, we close the figures before and after running the
functions.
Returns
-------
pyplot : module
The ``matplotlib.pyplot`` module.
"""
pyplot = pytest.importorskip("matplotlib.pyplot")
pyplot.close("all")
yield pyplot
pyplot.close("all")


@pytest.fixture(scope="function")
def plotly():
"""Check if we can import plotly.
If not, the tests will be skipped.
Returns
-------
plotly : module
The ``plotly`` module.
"""
plotly = pytest.importorskip("plotly")
yield plotly
Loading

0 comments on commit fadf7ff

Please sign in to comment.