Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheme: test if scheme examples can be opened #2242

Merged
merged 2 commits into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ recursive-include Orange/canvas/application/workflows *.ows

recursive-include Orange/widgets *.png *.svg *.js *.css *.html
recursive-include Orange/widgets/tests *.tab
recursive-include Orange/widgets/tests/workflows *.ows
recursive-include Orange/widgets/utils/plot *.fs *.vs *.gs *.obj

recursive-include distribute *.svg *.desktop
Expand Down
38 changes: 38 additions & 0 deletions Orange/widgets/tests/test_workflows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from itertools import chain
from os import listdir
from os.path import isfile, join, dirname

from Orange.canvas.application import workflows
from Orange.canvas.scheme import widgetsscheme
from Orange.canvas.scheme.readwrite import scheme_load
from Orange.widgets.tests.base import WidgetTest


def discover_workflows(tests_dir):
ows_path = join(tests_dir, "workflows")
ows_files = [f for f in listdir(ows_path)
if isfile(join(ows_path, f)) and f.endswith(".ows")]
for ows_file in ows_files:
yield join(ows_path, ows_file)

TEST_WORKFLOWS = chain(
[t.abspath() for t in workflows.example_workflows()],
discover_workflows(dirname(__file__))
)


class TestWorkflows(WidgetTest):
def test_scheme_examples(self):
"""
Test if Orange workflow examples can be opened. Examples in canvas
and also those placed "workflows" subfolder.
GH-2240
"""
for ows_file in TEST_WORKFLOWS:
new_scheme = widgetsscheme.WidgetsScheme()
with open(ows_file, "rb") as f:
try:
scheme_load(new_scheme, f)
except Exception as e:
self.fail("Old workflow '{}' could not be loaded\n'{}'".
format(ows_file, str(e)))
Loading