Defer a few more matplotlib imports

This commit is contained in:
Paul Romano 2023-04-26 09:48:05 -05:00
parent 664ae00cdc
commit f2549c9470
4 changed files with 11 additions and 11 deletions

View file

@ -6,7 +6,6 @@ import operator
import numpy as np
from scipy.spatial import ConvexHull, Delaunay
from matplotlib.path import Path
import openmc
from openmc.checkvalue import (check_greater_than, check_value,
@ -1021,6 +1020,7 @@ class Polygon(CompositeSurface):
-------
surfsets : a list of lists of surface, operator pairs
"""
from matplotlib.path import Path
# Get centroids of all the simplices and determine if they are inside
# the polygon defined by input vertices or not.

View file

@ -1,7 +0,0 @@
import sys
import openmc
def test_matplotlib_presence():
"""Checks that remains a deferred import"""
assert 'matplotlib.pyplot' not in sys.modules

View file

@ -0,0 +1,6 @@
import sys
import openmc
def test_matplotlib_presence():
"""Checks that matplotlib remains a deferred import"""
assert 'matplotlib' not in sys.modules

View file

@ -1,7 +1,6 @@
import numpy as np
import openmc
import pytest
from matplotlib.figure import Figure
@pytest.fixture(scope='module')
@ -74,8 +73,10 @@ def test_calculate_cexs_with_materials(test_mat):
@pytest.mark.parametrize("this", ["Be", "Be9"])
def test_plot_xs(this):
assert isinstance(openmc.plotter.plot_xs(this, types=['total']), Figure)
from matplotlib.figure import Figure
assert isinstance(openmc.plot_xs(this, types=['total']), Figure)
def test_plot_xs_mat(test_mat):
assert isinstance(openmc.plotter.plot_xs(test_mat, types=['total']), Figure)
from matplotlib.figure import Figure
assert isinstance(openmc.plot_xs(test_mat, types=['total']), Figure)