def test_check_workflow(session_scope_function): # load the workflow from the iris kit which is in the test data for kit in ['iris', 'boston_housing']: kit_path = os.path.join(HERE, 'data', '{}_kit'.format(kit)) problem_module = import_module_from_source( os.path.join(kit_path, 'problem.py'), 'problem') add_workflow(session_scope_function, problem_module.workflow) workflow = get_workflow(session_scope_function, None) assert len(workflow) == 2 assert isinstance(workflow, list) workflow = get_workflow(session_scope_function, 'Classifier') assert workflow.name == 'Classifier' assert isinstance(workflow, Workflow)
@property def element_names(self): if self.case == 'multiple-dot': return ['too.much.dot.workflow'] elif self.case == 'unknown-extension': return ['function.cpp'] @pytest.mark.parametrize("case, err_msg", [('multiple-dot', 'should contain at most one "."'), ('unknown-extension', 'Unknown extension')]) def test_add_workflow_error(case, err_msg, session_scope_function): workflow = WorkflowFaultyElements(case=case) with pytest.raises(ValueError, match=err_msg): add_workflow(session_scope_function, workflow) # TODO: there is no easy way to test a non valid type extension. def test_check_workflow(session_scope_function): # load the workflow from the iris kit which is in the test data for kit in ['iris', 'boston_housing']: kit_path = os.path.join(HERE, 'data', '{}_kit'.format(kit)) problem_module = import_module_from_source( os.path.join(kit_path, 'problem.py'), 'problem') add_workflow(session_scope_function, problem_module.workflow) workflow = get_workflow(session_scope_function, None) assert len(workflow) == 2 assert isinstance(workflow, list) workflow = get_workflow(session_scope_function, 'Classifier') assert workflow.name == 'Classifier'