def to_obj(self) -> Project: p = Project(self.name, id=self.id, author=self.author, creation_date=self.creation_date) for task in self.tasks: p._tasks.add(task.to_obj()) return self.attach(p)
def factory(saved=False): nonlocal counter counter += 1 project = Project('Test Project-{}'.format(counter)) if saved: p = meta.create_project(project) return p return project
def test_pipeline_buildable(metadata_repo, pipeline): proj = Project('proj') task = Task('Test Task') proj = metadata_repo.create_project(proj) task.project = proj task = metadata_repo.create_task(task) pipeline.task = task pipeline = metadata_repo.create_pipeline(pipeline) buildable = PipelineBuildable(pipeline, server_type=FlaskServer.type) assert buildable.get_provider().get_python_version( ) == platform.python_version() assert buildable.task.name == 'Test Task' assert buildable.pipeline == pipeline
def test_multimodel_buildable(metadata_repo): # Dunno why, but it only worked w/o fixtures proj = Project('proj') task = Task('Test Task') mdl = Model.create(lambda data: data, 'input', 'test_model') proj = metadata_repo.create_project(proj) task.project = proj task = metadata_repo.create_task(task) mdl.task = task mdl = metadata_repo.create_model(mdl) with pytest.raises(ValueError): MultiModelBuildable([], server_type=FlaskServer.type) assert mdl.has_meta_repo mm_buildable = MultiModelBuildable([mdl], server_type=FlaskServer.type) assert mm_buildable.task.name == 'Test Task' assert mm_buildable.get_provider().get_python_version( ) == platform.python_version() assert len(mm_buildable.models) == 1
def project2(): return Project('Test project2')
def project(author, creation_date): return Project("Test project", author=author, creation_date=creation_date)