diff options
Diffstat (limited to 'test/sca/test_plot.py')
| -rw-r--r-- | test/sca/test_plot.py | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/test/sca/test_plot.py b/test/sca/test_plot.py index 7d2cec0..2722ba3 100644 --- a/test/sca/test_plot.py +++ b/test/sca/test_plot.py @@ -1,8 +1,8 @@ -from os import getenv - import numpy as np import holoviews as hv import matplotlib as mpl +import pytest + from pyecsca.sca.trace import Trace from pyecsca.sca.trace.plot import ( plot_trace, @@ -11,34 +11,35 @@ from pyecsca.sca.trace.plot import ( save_figure_svg, plot_traces, ) -from .utils import Plottable -class PlotTests(Plottable): - def setUp(self) -> None: - self.trace1 = Trace(np.array([6, 7, 3, -2, 5, 1], dtype=np.dtype("i1"))) - self.trace2 = Trace(np.array([2, 3, 7, 0, -1, 0], dtype=np.dtype("i1"))) +@pytest.fixture() +def trace1(): + return Trace(np.array([6, 7, 3, -2, 5, 1], dtype=np.dtype("i1"))) + + +@pytest.fixture() +def trace2(): + return Trace(np.array([2, 3, 7, 0, -1, 0], dtype=np.dtype("i1"))) + + +def test_html(trace1, trace2, plot_path): + hv.extension("bokeh") + fig = plot_trace(trace1) + save_figure(fig, str(plot_path())) + other = plot_traces(trace1, trace2) + save_figure(other, str(plot_path())) + - def test_html(self): - if getenv("PYECSCA_TEST_PLOTS") is None: - return - hv.extension("bokeh") - fig = plot_trace(self.trace1) - save_figure(fig, self.get_fname()) - other = plot_traces(self.trace1, self.trace2) - save_figure(other, self.get_fname()) +@pytest.mark.skip("Broken") +def test_png(trace1, plot_path): + hv.extension("matplotlib") + mpl.use("agg") + fig = plot_trace(trace1) + save_figure_png(fig, str(plot_path())) - def test_png(self): - if getenv("PYECSCA_TEST_PLOTS") is None: - return - hv.extension("matplotlib") - mpl.use("agg") - fig = plot_trace(self.trace1) - save_figure_png(fig, self.get_fname()) - def test_svg(self): - if getenv("PYECSCA_TEST_PLOTS") is None: - return - hv.extension("matplotlib") - fig = plot_trace(self.trace1) - save_figure_svg(fig, self.get_fname()) +def test_svg(trace1, plot_path): + hv.extension("matplotlib") + fig = plot_trace(trace1) + save_figure_svg(fig, str(plot_path())) |
