You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ki...@apache.org on 2021/11/19 09:24:28 UTC
[dolphinscheduler] branch dev updated: [python] Add ut cover process definitions separate mode (#6908)
This is an automated email from the ASF dual-hosted git repository.
kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 6e812be [python] Add ut cover process definitions separate mode (#6908)
6e812be is described below
commit 6e812be14d6ca28dba4a67094a38a2947d92c46a
Author: Jiajie Zhong <zh...@hotmail.com>
AuthorDate: Fri Nov 19 17:24:19 2021 +0800
[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
---
.../tests/core/test_process_definition.py | 28 ++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/dolphinscheduler-python/pydolphinscheduler/tests/core/test_process_definition.py b/dolphinscheduler-python/pydolphinscheduler/tests/core/test_process_definition.py
index ae048c2..0359b29 100644
--- a/dolphinscheduler-python/pydolphinscheduler/tests/core/test_process_definition.py
+++ b/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",
[