Commit ac87bab5 authored by Wout De Nolf's avatar Wout De Nolf
Browse files

ewokscore.tests.examples: API change

parent 9c79ccfd
Pipeline #49946 passed with stage
in 1 minute and 55 seconds
......@@ -2,7 +2,7 @@ from Orange.widgets import gui
from ewoksorange.bindings import OWEwoksWidget
from ewoksorange.gui.parameterform import ParameterForm
from ewokscore.tests.examples.tasks import SumTask
from ewokscore.tests.examples.tasks.sumtask import SumTask
__all__ = ["Adder1"]
......
......@@ -2,7 +2,7 @@ from Orange.widgets import gui
from ewoksorange.bindings import OWEwoksWidget
from ewoksorange.gui.parameterform import ParameterForm
from ewokscore.tests.examples.tasks import SumTask
from ewokscore.tests.examples.tasks.sumtask import SumTask
__all__ = ["Adder2"]
......
<?xml version='1.0' encoding='utf-8'?>
<scheme version="2.0" title="SumTask (Custom cat.)" description="taskgraphlib.taskgraphs.acyclic_graph1">
<scheme version="2.0" title="SumTask (Custom cat.)" description="acyclic1">
<nodes>
<node id="0" name="Adder1" qualified_name="orangecontrib.customcategory.adder1.Adder1" project_name="ewoks_example_addon" title="task1" position="(0.0, 0.0)" />
<node id="1" name="Adder2" qualified_name="orangecontrib.customcategory.adder2.Adder2" project_name="ewoks_example_addon" title="task2" position="(155.0, 308.0)" />
......
......@@ -2,7 +2,7 @@ from Orange.widgets import gui
from ewoksorange.bindings import OWEwoksWidget
from ewoksorange.gui.parameterform import ParameterForm
from ewokscore.tests.examples.tasks import SumTask
from ewokscore.tests.examples.tasks.sumtask import SumTask
__all__ = ["Adder1"]
......
......@@ -2,7 +2,7 @@ from Orange.widgets import gui
from ewoksorange.bindings import OWEwoksWidget
from ewoksorange.gui.parameterform import ParameterForm
from ewokscore.tests.examples.tasks import SumTask
from ewokscore.tests.examples.tasks.sumtask import SumTask
__all__ = ["Adder2"]
......
<?xml version='1.0' encoding='utf-8'?>
<scheme version="2.0" title="SumTask (Custom super cat.)" description="taskgraphlib.taskgraphs.acyclic_graph1">
<scheme version="2.0" title="SumTask (Custom super cat.)" description="acyclic1">
<nodes>
<node id="0" name="Adder1" qualified_name="orangecontrib.customsupercategory.customsubcategory.adder1.Adder1" project_name="ewoks_example_addon" title="task1" position="(0.0, 0.0)" />
<node id="1" name="Adder2" qualified_name="orangecontrib.customsupercategory.customsubcategory.adder2.Adder2" project_name="ewoks_example_addon" title="task2" position="(155.0, 308.0)" />
......
......@@ -2,7 +2,7 @@ from Orange.widgets import gui
from ewoksorange.bindings import OWEwoksWidget
from ewoksorange.gui.parameterform import ParameterForm
from ewokscore.tests.examples.tasks import SumTask
from ewokscore.tests.examples.tasks.sumtask import SumTask
__all__ = ["Adder1"]
......
......@@ -2,7 +2,7 @@ from Orange.widgets import gui
from ewoksorange.bindings import OWEwoksWidget
from ewoksorange.gui.parameterform import ParameterForm
from ewokscore.tests.examples.tasks import SumTask
from ewokscore.tests.examples.tasks.sumtask import SumTask
__all__ = ["Adder2"]
......
<?xml version='1.0' encoding='utf-8'?>
<scheme version="2.0" title="SumTask (Evaluate cat.)" description="taskgraphlib.taskgraphs.acyclic_graph1">
<scheme version="2.0" title="SumTask (Evaluate cat.)" description="acyclic1">
<nodes>
<node id="0" name="Adder1" qualified_name="orangecontrib.evaluate.submodule.adder1.Adder1" project_name="ewoks_example_addon" title="task1" position="(0.0, 0.0)" />
<node id="1" name="Adder2" qualified_name="orangecontrib.evaluate.submodule.adder2.Adder2" project_name="ewoks_example_addon" title="task2" position="(155.0, 308.0)" />
......
......@@ -2,8 +2,9 @@ import sys
import logging
import pytest
from ewoksorange import execute_graph
from ewokscore.tests.examples import graphs
from ewokscore.tests.examples.graphs import get_graph
from ewokscore.tests.utils import assert_taskgraph_result
from ewokscore import load_graph
logging.getLogger("orange").setLevel(logging.DEBUG)
logging.getLogger("orange").addHandler(logging.StreamHandler(sys.stdout))
......@@ -11,9 +12,14 @@ logging.getLogger("ewoksorange").setLevel(logging.DEBUG)
logging.getLogger("ewoksorange").addHandler(logging.StreamHandler(sys.stdout))
@pytest.mark.skip("TODO: hashes are different due to static input")
def test_execute_graph(tmpdir):
@pytest.mark.parametrize("graph_name", ["acyclic2", "cyclic1"])
def test_execute_graph(graph_name, tmpdir):
graph, expected = get_graph(graph_name)
ewoksgraph = load_graph(graph)
varinfo = {"root_uri": str(tmpdir)}
graph, expected = graphs.acyclic_graph1()
execute_graph(graph, varinfo=varinfo)
assert_taskgraph_result(graph, expected, varinfo)
if ewoksgraph.is_cyclic or ewoksgraph.has_conditional_links:
with pytest.raises(RuntimeError):
execute_graph(graph, varinfo=varinfo)
else:
execute_graph(graph, varinfo=varinfo)
assert_taskgraph_result(ewoksgraph, expected, varinfo=varinfo)
......@@ -2,9 +2,11 @@ try:
from importlib import resources
except ImportError:
import importlib_resources as resources
import pytest
from ewoksorange import owsconvert
from ewokscore import load_graph
from ewokscore.tests.examples import graphs
from ewokscore.tests.examples.graphs import graph_names
from ewokscore.tests.examples.graphs import get_graph
def test_ows_to_ewoks(tmpdir, register_ewoks_example_addon):
......@@ -19,11 +21,16 @@ def test_ows_to_ewoks(tmpdir, register_ewoks_example_addon):
assert ewoksgraph == ewoksgraph2
def test_ewoks_to_ows(tmpdir):
graph, _ = graphs.acyclic_graph1()
@pytest.mark.parametrize("graph_name", graph_names())
def test_ewoks_to_ows(graph_name, tmpdir):
graph, _ = get_graph(graph_name)
ewoksgraph = load_graph(graph)
destination = str(tmpdir / "ewoksgraph2.ows")
if ewoksgraph.is_cyclic or ewoksgraph.has_conditional_links:
with pytest.raises(RuntimeError):
owsconvert.ewoks_to_ows(ewoksgraph, destination)
return
owsconvert.ewoks_to_ows(ewoksgraph, destination)
ewoksgraph2 = owsconvert.ows_to_ewoks(destination)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment