def test1(self): """Exercises aliasing on modules""" import core.vistrail from core.db.locator import XMLFileLocator v = XMLFileLocator(core.system.vistrails_root_directory() + '/tests/resources/dummy.xml').load() p1 = v.getPipeline('final') p2 = v.getPipeline('final') self.assertEquals(len(p1.modules), len(p2.modules)) for k in p1.modules.keys(): if p1.modules[k] is p2.modules[k]: self.fail("didn't expect aliases in two different pipelines")
def test_cache(self): from core.db.locator import XMLFileLocator """Test if basic caching is working.""" v = XMLFileLocator(core.system.vistrails_root_directory() + "/tests/resources/dummy.xml").load() p1 = v.getPipeline("int chain") n = v.get_version_number("int chain") view = DummyView() interpreter = core.interpreter.cached.CachedInterpreter.get() result = interpreter.execute(None, p1, "dummy.xml", n, view) # to force fresh params p2 = v.getPipeline("int chain") result = interpreter.execute(None, p2, "dummy.xml", n, view) assert len(result.modules_added) == 1
def test_ticket_73(self): # Tests serializing a custom-named module to disk locator = XMLFileLocator(core.system.vistrails_root_directory() + '/tests/resources/test_ticket_73.xml') v = locator.load() import tempfile (fd, filename) = tempfile.mkstemp() os.close(fd) locator = XMLFileLocator(filename) try: locator.save(v) finally: os.remove(filename)
def testIncorrectURL_2(self): import core.vistrail from core.db.locator import XMLFileLocator from core.vistrail.module import Module from core.vistrail.module_function import ModuleFunction from core.vistrail.module_param import ModuleParam import core.interpreter p = core.vistrail.pipeline.Pipeline() m_param = ModuleParam( type='String', val='http://neitherodesthisohrly', ) m_function = ModuleFunction( name='url', parameters=[m_param], ) p.add_module( Module( name='HTTPFile', package=identifier, version=version, id=0, functions=[m_function], )) interpreter = core.interpreter.default.get_default_interpreter() kwargs = { 'locator': XMLFileLocator('foo'), 'current_version': 1L, 'view': DummyView(), }
def test2(self): """Exercises aliasing on points""" import core.vistrail from core.db.locator import XMLFileLocator import core.system v = XMLFileLocator(core.system.vistrails_root_directory() + '/tests/resources/dummy.xml').load() p1 = v.getPipeline('final') v.getPipeline('final') p2 = v.getPipeline('final') m1s = p1.modules.items() m2s = p2.modules.items() m1s.sort() m2s.sort() for ((i1,m1),(i2,m2)) in izip(m1s, m2s): self.assertEquals(m1.center.x, m2.center.x) self.assertEquals(m1.center.y, m2.center.y)
def test_change_parameter(self): locator = XMLFileLocator(core.system.vistrails_root_directory() + '/tests/resources/test_change_vistrail.xml') result = run([(locator, "v1")], update_vistrail=False) self.assertEqual(len(result), 0) result = run([(locator, "v2")], update_vistrail=False) self.assertEquals(len(result), 0)
def test_tuple(self): from core.vistrail.module_param import ModuleParam from core.vistrail.module_function import ModuleFunction from core.utils import DummyView from core.vistrail.module import Module import db.domain id_scope = db.domain.IdScope() interpreter = core.interpreter.default.get_default_interpreter() v = DummyView() p = core.vistrail.pipeline.Pipeline() params = [ ModuleParam( id=id_scope.getNewId(ModuleParam.vtType), pos=0, type='Float', val='2.0', ), ModuleParam( id=id_scope.getNewId(ModuleParam.vtType), pos=1, type='Float', val='2.0', ) ] function = ModuleFunction(id=id_scope.getNewId(ModuleFunction.vtType), name='input') function.add_parameters(params) module = Module(id=id_scope.getNewId(Module.vtType), name='TestTupleExecution', package='edu.utah.sci.vistrails.console_mode_test', version='0.9.0') module.add_function(function) p.add_module(module) kwargs = { 'locator': XMLFileLocator('foo'), 'current_version': 1L, 'view': v, }
def test2(self): """Exercises aliasing on points""" import core.vistrail from core.db.locator import XMLFileLocator import core.system v = XMLFileLocator(core.system.vistrails_root_directory() + '/tests/resources/dummy.xml').load() p1 = v.getPipeline('final') v.getPipeline('final') p2 = v.getPipeline('final') m1s = p1.modules.items() m2s = p2.modules.items() m1s.sort() m2s.sort() for ((i1, m1), (i2, m2)) in izip(m1s, m2s): self.assertEquals(m1.center.x, m2.center.x) self.assertEquals(m1.center.y, m2.center.y)
def test_cache(self): from core.db.locator import XMLFileLocator from core.vistrail.controller import VistrailController from core.db.io import load_vistrail """Test if basic caching is working.""" locator = XMLFileLocator(core.system.vistrails_root_directory() + '/tests/resources/dummy.xml') (v, abstractions, thumbnails, mashups) = load_vistrail(locator) # the controller will take care of upgrades controller = VistrailController() controller.set_vistrail(v, locator, abstractions, thumbnails, mashups) p1 = v.getPipeline('int chain') n = v.get_version_number('int chain') controller.change_selected_version(n) controller.flush_delayed_actions() p1 = controller.current_pipeline view = DummyView() interpreter = core.interpreter.cached.CachedInterpreter.get() result = interpreter.execute(p1, locator=v, current_version=n, view=view, ) # to force fresh params p2 = v.getPipeline('int chain') controller.change_selected_version(n) controller.flush_delayed_actions() p2 = controller.current_pipeline result = interpreter.execute(p2, locator=v, current_version=n, view=view, ) assert len(result.modules_added) == 1
def test15(self): import core.vistrail from core.db.locator import XMLFileLocator import core.system v = XMLFileLocator(core.system.vistrails_root_directory() + '/tests/resources/dummy.xml').load()
def test_dynamic_module_error(self): locator = XMLFileLocator(core.system.vistrails_root_directory() + '/tests/resources/dynamic_module_error.xml') result = run([(locator, "test")], update_vistrail=False) self.assertNotEqual(len(result), 0)
def test_python_source_2(self): locator = XMLFileLocator(core.system.vistrails_root_directory() + '/tests/resources/pythonsource.xml') result = run_and_get_results([(locator, "test_simple_success")], update_vistrail=False)[0] self.assertEquals(len(result.executed), 1)
def test_python_source(self): locator = XMLFileLocator(core.system.vistrails_root_directory() + '/tests/resources/pythonsource.xml') result = run([(locator, "testPortsAndFail")], update_vistrail=False) self.assertEqual(len(result), 0)
def test1(self): locator = XMLFileLocator(core.system.vistrails_root_directory() + '/tests/resources/dummy.xml') result = run([(locator, "int chain")], update_vistrail=False) self.assertEqual(len(result), 0)