Browse Source

[python] Add ut cover process definitions separate mode (#6908)

* [python] Add ut cover process definitions separate mode

* Remove unused print syntax

* Fix test error, cause raw_script not exists anymore
3.0.0/version-upgrade
Jiajie Zhong 3 years ago committed by GitHub
parent
commit
6e812be14d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      dolphinscheduler-python/pydolphinscheduler/tests/core/test_process_definition.py

28
dolphinscheduler-python/pydolphinscheduler/tests/core/test_process_definition.py

@ -170,8 +170,8 @@ def test_process_definition_to_dict_without_task():
assert pd.to_dict() == expect
def test_process_definition_simple():
"""Test process definition simple create workflow, including process definition, task, relation define."""
def test_process_definition_simple_context_manager():
"""Test simple create workflow in process definition context manager mode."""
expect_tasks_num = 5
with ProcessDefinition(TEST_PROCESS_DEFINITION_NAME) as pd:
for i in range(expect_tasks_num):
@ -211,6 +211,30 @@ def test_process_definition_simple():
}
def test_process_definition_simple_separate():
"""Test process definition simple create workflow in separate mode.
This test just test basic information, cause most of test case is duplicate to
test_process_definition_simple_context_manager.
"""
expect_tasks_num = 5
pd = ProcessDefinition(TEST_PROCESS_DEFINITION_NAME)
for i in range(expect_tasks_num):
task_params = TaskParams()
curr_task = Task(
name=f"task-{i}",
task_type=f"type-{i}",
task_params=task_params,
process_definition=pd,
)
# Set deps task i as i-1 parent
if i > 0:
pre_task = pd.get_one_task_by_name(f"task-{i - 1}")
curr_task.set_upstream(pre_task)
assert len(pd.tasks) == expect_tasks_num
assert all(["task-" in task.name for task in pd.task_list])
@pytest.mark.parametrize(
"user_attrs",
[

Loading…
Cancel
Save