def test_create_gantt_plotly(): c1 = BaseComponent("c1") task11 = BaseTask("task11") task12 = BaseTask("task12") c1.extend_targeted_task_list([task11, task12]) c2 = BaseComponent("c2") task2 = BaseTask("task2") c2.append_targeted_task(task2) product = BaseProduct([c1, c2]) # Set test case task11.start_time_list = [0, 2] task11.ready_time_list = [0, 2] task11.finish_time_list = [3, 5] task12.start_time_list = [1] task12.ready_time_list = [2] task12.finish_time_list = [5] task2.start_time_list = [1] task2.ready_time_list = [2] task2.finish_time_list = [5] init_datetime = datetime.datetime(2020, 4, 1, 8, 0, 0) timedelta = datetime.timedelta(days=1) product.create_gantt_plotly(init_datetime, timedelta, save_fig_path="test.png") if os.path.exists("test.png"): os.remove("test.png")
def test_create_gantt_plotly(tmpdir): """test_create_gantt_plotly.""" c1 = BaseComponent("c1") c2 = BaseComponent("c2") product = BaseProduct([c1, c2]) # Set test case c1.state_record_list = [ BaseTaskState.READY, BaseTaskState.WORKING, BaseTaskState.FINISHED, BaseTaskState.WORKING, BaseTaskState.WORKING, BaseTaskState.FINISHED, ] c2.state_record_list = [ BaseTaskState.WORKING, BaseTaskState.WORKING, BaseTaskState.FINISHED, BaseTaskState.WORKING, BaseTaskState.FINISHED, BaseTaskState.FINISHED, ] init_datetime = datetime.datetime(2020, 4, 1, 8, 0, 0) timedelta = datetime.timedelta(days=1) for ext in ["png", "html", "json"]: save_fig_path = os.path.join(str(tmpdir), "test." + ext) product.create_gantt_plotly(init_datetime, timedelta, save_fig_path=save_fig_path)