Skip to content

Commit e6e5245

Browse files
committed
fix tests
1 parent 102fe8b commit e6e5245

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

examples/notebook_vars.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"from matplotlib import pyplot \n",
1313
"from open_atmos_jupyter_utils import show_plot\n",
1414
"\n",
15-
"pyplot.plot([])\n",
16-
"show_plot()"
15+
"fig = pyplot.figure()\n",
16+
"show_plot(fig)"
1717
],
1818
"id": "840cd46405eb9d0e",
1919
"outputs": [

tests/test_notebook_vars.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
import pytest
77
import matplotlib
88

9+
910
from open_atmos_jupyter_utils import notebook_vars
10-
import examples
1111

1212
@pytest.fixture(scope="session", name="notebook_variables")
1313
def notebook_variables_fixture():
1414
"""returns variables from the notebook """
1515
return notebook_vars(
16-
file=Path(examples.__file__).parent / "notebook_vars.ipynb",
16+
file=str(Path(__file__).parent.parent / "examples" / "notebook_vars.ipynb"),
1717
plot=False,
1818
)
1919
class TestNotebookVars:
@@ -24,6 +24,7 @@ def test_notebook_vars(notebook_variables):
2424
assert notebook_variables["c"] == notebook_variables["a"] + notebook_variables["b"]
2525

2626
@staticmethod
27-
def test_plots_closed():
27+
def test_plots_closed(notebook_variables):
2828
""" checks all figures closed """
29+
assert isinstance(notebook_variables["fig"], matplotlib.figure.Figure)
2930
assert 0 == len(matplotlib.pyplot.get_fignums())

0 commit comments

Comments
 (0)