From 29666671ccbc1c2998fb0bbbe13b14877a0dc2be Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson <oscar.gustafsson@gmail.com> Date: Tue, 17 Jan 2023 12:31:49 +0100 Subject: [PATCH] Fix GraphViz test issues --- .gitlab-ci.yml | 2 +- b_asic/signal_flow_graph.py | 7 ++++++- test/test_sfg.py | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 97c4171e..0bd20c7b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: before_script: - apt-get update --yes - - apt-get install --yes build-essential cmake libfmt-dev pybind11-dev graphviz python3-pyqt5 xvfb + - apt-get install --yes build-essential cmake libfmt-dev pybind11-dev graphviz python3-pyqt5 xvfb xdg-utils - python -m pip install --upgrade pip - python --version - pip install pytest pytest-cov sphinx furo numpydoc pytest-xvfb pytest-qt setuptools_scm sphinx-qt-documentation diff --git a/b_asic/signal_flow_graph.py b/b_asic/signal_flow_graph.py index 3a99b051..d089311c 100644 --- a/b_asic/signal_flow_graph.py +++ b/b_asic/signal_flow_graph.py @@ -1205,7 +1205,8 @@ class SFG(AbstractOperation): """ dg = Digraph() dg.attr(rankdir="LR") - dg.engine = 'dot' if engine is None else engine + if engine is not None: + dg.engine = engine for op in self._components_by_id.values(): if isinstance(op, Signal): if show_id: @@ -1249,4 +1250,8 @@ class SFG(AbstractOperation): """ dg = self.sfg(show_id=show_id) + if engine is not None: + dg.engine = engine + if format is not None: + dg.format = format dg.view() diff --git a/test/test_sfg.py b/test/test_sfg.py index 8c80b85a..a37caa79 100644 --- a/test/test_sfg.py +++ b/test/test_sfg.py @@ -1398,9 +1398,9 @@ class TestSFGGraph: assert sfg_simple_filter.sfg(show_id=True).source == res def test_show_sfg_invalid_format(self, sfg_simple_filter): - with pytest.raises(AssertionError): + with pytest.raises(ValueError): sfg_simple_filter.show_sfg(format="ppddff") def test_show_sfg_invalid_engine(self, sfg_simple_filter): - with pytest.raises(AssertionError): + with pytest.raises(ValueError): sfg_simple_filter.show_sfg(engine="ppddff") -- GitLab