Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
agoscinski committed Dec 31, 2024
1 parent 00257fc commit c878aba
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions tests/test_wc_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

from sirocco.core import Workflow
from sirocco.workgraph import AiidaWorkGraph
from sirocco.pretty_print import PrettyPrinter
from sirocco.vizgraph import VizGraph


@pytest.fixture
def pprinter():
return PrettyPrinter()

# configs that are tested for parsing
config_test_files = [
Expand All @@ -23,29 +30,24 @@ def config_paths(request):
}


# @pytest.fixture
# def pprinter():
# return PrettyPrinter()
#
#
# def test_parse_config_file(config_paths, pprinter):
# reference_str = config_paths["txt"].read_text()
# test_str = pprinter.format(Workflow.from_yaml(config_paths["yml"]))
# if test_str != reference_str:
# new_path = Path(config_paths["txt"]).with_suffix(".new.txt")
# new_path.write_text(test_str)
# assert (
# reference_str == test_str
# ), f"Workflow graph doesn't match serialized data. New graph string dumped to {new_path}."
#
#
# @pytest.mark.skip(reason="don't run it each time, uncomment to regenerate serilaized data")
# def test_serialize_workflow(config_paths, pprinter):
# config_paths["txt"].write_text(pprinter.format(Workflow.from_yaml(config_paths["yml"])))
#
#
# def test_vizgraph(config_paths):
# VizGraph.from_yaml(config_paths["yml"]).draw(file_path=config_paths["svg"])
def test_parse_config_file(config_paths, pprinter):
reference_str = config_paths["txt"].read_text()
test_str = pprinter.format(Workflow.from_yaml(config_paths["yml"]))
if test_str != reference_str:
new_path = Path(config_paths["txt"]).with_suffix(".new.txt")
new_path.write_text(test_str)
assert (
reference_str == test_str
), f"Workflow graph doesn't match serialized data. New graph string dumped to {new_path}."


@pytest.mark.skip(reason="don't run it each time, uncomment to regenerate serilaized data")
def test_serialize_workflow(config_paths, pprinter):
config_paths["txt"].write_text(pprinter.format(Workflow.from_yaml(config_paths["yml"])))


def test_vizgraph(config_paths):
VizGraph.from_yaml(config_paths["yml"]).draw(file_path=config_paths["svg"])


# configs that are tested for running workgraph
Expand Down

0 comments on commit c878aba

Please sign in to comment.