haystack/test/core/pipeline/test_draw_graphviz.py
Massimiliano Pippi 84da80c1f3
chore: make core tests layout consistent (#6449)
* move unit tests up

* move tests up one dir, make them unit
2023-11-29 18:58:44 +01:00

27 lines
789 B
Python

# SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
#
# SPDX-License-Identifier: Apache-2.0
import os
import filecmp
import pytest
from haystack.core.pipeline import Pipeline
from haystack.core.pipeline.draw.draw import _draw
from haystack.testing.sample_components import Double
pygraphviz = pytest.importorskip("pygraphviz")
@pytest.mark.integration
def test_draw_pygraphviz(tmp_path, test_files):
pipe = Pipeline()
pipe.add_component("comp1", Double())
pipe.add_component("comp2", Double())
pipe.connect("comp1", "comp2")
_draw(pipe.graph, tmp_path / "test_pipe.jpg", engine="graphviz")
assert os.path.exists(tmp_path / "test_pipe.jpg")
assert filecmp.cmp(tmp_path / "test_pipe.jpg", test_files / "pipeline_draw" / "pygraphviz.jpg")