当前位置: 首页>>代码示例>>Python>>正文


Python BaseEntity.add_dep方法代码示例

本文整理汇总了Python中MilkCheck.Engine.BaseEntity.BaseEntity.add_dep方法的典型用法代码示例。如果您正苦于以下问题:Python BaseEntity.add_dep方法的具体用法?Python BaseEntity.add_dep怎么用?Python BaseEntity.add_dep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MilkCheck.Engine.BaseEntity.BaseEntity的用法示例。


在下文中一共展示了BaseEntity.add_dep方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_add_dep_parents

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_add_dep_parents(self):
     """Test method add dependency for parents"""
     ent = BaseEntity('foo')
     ent_dep = BaseEntity('parent')
     ent.add_dep(ent_dep)
     self.assertTrue(ent.has_parent_dep('parent'))
     self.assertTrue(ent_dep.has_child_dep('foo'))
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:9,代码来源:BaseEntityTest.py

示例2: test_add_dep_children

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_add_dep_children(self):
     """Test method add_dep for children"""
     ent = BaseEntity('foo')
     ent_dep = BaseEntity('child')
     ent.add_dep(target=ent_dep, parent=False)
     self.assertTrue(ent.has_child_dep('child'))
     self.assertTrue(ent_dep.has_parent_dep('foo'))
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:9,代码来源:BaseEntityTest.py

示例3: test_clear_deps

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_clear_deps(self):
     """Test method clear_deps"""
     ent = BaseEntity('foo')
     ent_dep = BaseEntity('parent')
     ent.add_dep(ent_dep)
     self.assertEqual(len(ent.parents), 1)
     ent.clear_deps()
     self.assertEqual(len(ent.parents), 0)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:10,代码来源:BaseEntityTest.py

示例4: test_eval_deps_waiting

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_eval_deps_waiting(self):
     """Test that eval_deps_status return WAITING_STATUS"""
     service = BaseEntity("test_service")
     serv_a = BaseEntity("A")
     serv_b = BaseEntity("B")
     service.add_dep(serv_a)
     service.add_dep(serv_b, CHECK)
     serv_a.status = WAITING_STATUS
     self.assertEqual(service.eval_deps_status(), WAITING_STATUS)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:11,代码来源:BaseEntityTest.py

示例5: test_clear_childs

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_clear_childs(self):
     '''Test remove all childrens dependencies'''
     ent1 = BaseEntity(name='A')
     ent2 = BaseEntity(name='B')
     ent3 = BaseEntity(name='C')
     ent1.add_dep(target=ent2, parent=False)
     ent1.add_dep(target=ent3, parent=False)
     ent1.clear_child_deps()
     self.assertFalse(ent1.has_child_dep('B'))
     self.assertFalse(ent1.has_child_dep('C'))
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:12,代码来源:BaseEntityTest.py

示例6: test_clear_parents

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_clear_parents(self):
     '''Test remove all parents dependencies'''
     ent1 = BaseEntity(name='A')
     ent2 = BaseEntity(name='B')
     ent3 = BaseEntity(name='C')
     ent1.add_dep(target=ent2)
     ent1.add_dep(target=ent3)
     ent1.clear_parent_deps()
     self.assertFalse(ent1.has_parent_dep('B'))
     self.assertFalse(ent1.has_parent_dep('C'))
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:12,代码来源:BaseEntityTest.py

示例7: test_eval_deps_error

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_eval_deps_error(self):
     """Test that eval_deps_status return DEP_ERROR"""
     service = BaseEntity("test_service")
     serv_a = BaseEntity("A")
     serv_b = BaseEntity("B")
     service.add_dep(serv_a)
     service.add_dep(serv_b, CHECK)
     serv_b.status = DONE
     serv_a.status = TIMEOUT
     self.assertEqual(service.eval_deps_status(), DEP_ERROR)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:12,代码来源:BaseEntityTest.py

示例8: test_excluded

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
    def test_excluded(self):
        """Test the excluded mecanism"""
        ent1 = BaseEntity('E1')
        ent2 = BaseEntity('E2')
        ent3 = BaseEntity('E3')

        ent3.add_dep(ent2)

        self.assertFalse(ent1.excluded())
        self.assertTrue(ent1.excluded(["E1"]))
        self.assertTrue(ent3.excluded(["E2"]))
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:13,代码来源:BaseEntityTest.py

示例9: test_eval_deps_no_status

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_eval_deps_no_status(self):
     """Test that eval_deps_status return NO_STATUS"""
     service = BaseEntity("test_service")
     serv_a = BaseEntity("A")
     serv_b = BaseEntity("B")
     serv_a.status = WARNING
     service.add_dep(serv_a)
     service.add_dep(serv_b, CHECK)
     self.assertEqual(service.eval_deps_status(), NO_STATUS)
     serv_a.status = NO_STATUS
     serv_b.status = WARNING
     self.assertEqual(service.eval_deps_status(), NO_STATUS)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:14,代码来源:BaseEntityTest.py

示例10: test_eval_deps_warnings

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_eval_deps_warnings(self):
     """eval_deps_status() is DONE with REQUIRE_WEAK on error"""
     service = BaseEntity("test_service")
     serv_a = BaseEntity("A")
     serv_b = BaseEntity("B")
     service.add_dep(serv_a, REQUIRE_WEAK)
     service.add_dep(serv_b, REQUIRE_WEAK)
     serv_a.status = DONE
     serv_b.status = ERROR
     self.assertEqual(service.eval_deps_status(), DONE)
     serv_b.status = DEP_ERROR
     serv_a.status = TIMEOUT
     self.assertEqual(service.eval_deps_status(), DONE)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:15,代码来源:BaseEntityTest.py

示例11: test_is_ready

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_is_ready(self):
     """Test method allowing us to determine if a service can be processed"""
     ent = BaseEntity('foo')
     ent_dep = BaseEntity('parent')
     ent_dep2 = BaseEntity('parent2')
     ent.add_dep(ent_dep)
     ent.add_dep(ent_dep2)
     self.assertFalse(ent.is_ready())
     ent_dep.status = WAITING_STATUS
     self.assertFalse(ent.is_ready())
     ent_dep.status = DONE
     ent_dep2.status = DONE
     self.assertTrue(ent.is_ready())
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:15,代码来源:BaseEntityTest.py

示例12: test_add_dep_bad_cases

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
    def test_add_dep_bad_cases(self):
        """Test bad usage of the method add_dep"""
        ent = BaseEntity('foo')
        ent_dep = BaseEntity('child')
        ent.add_dep(ent_dep, CHECK)

        # Dependency with a None Service
        self.assertRaises(AssertionError, ent.add_dep, None)

        # Dependency with bad name identifier
        self.assertRaises(IllegalDependencyTypeError,
            ent.add_dep, BaseEntity('A'), 'BAD')

        #Already referenced dependency 
        r_ent = BaseEntity('child')
        self.assertRaises(DependencyAlreadyReferenced,
            ent.add_dep, r_ent)

        #Same with reversed dependency
        ent.add_dep(ent_dep, CHECK, parent=False)
        self.assertRaises(DependencyAlreadyReferenced,
            ent.add_dep, r_ent, parent=False)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:24,代码来源:BaseEntityTest.py

示例13: test_search_node_graph_reverse

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_search_node_graph_reverse(self):
     """Test the research of node through a graph in reverse mod"""
     ent1 = BaseEntity('E1')
     ent2 = BaseEntity('E2')
     ent3 = BaseEntity('E3')
     ent4 = BaseEntity('E4')
     ent1.add_dep(ent2)
     ent1.add_dep(ent3)
     ent2.add_dep(ent4)
     ent3.add_dep(ent4)
     self.assertTrue(ent4.search('E1', True) is ent1)
     self.assertTrue(ent4.search('E5', True) is None)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:14,代码来源:BaseEntityTest.py

示例14: test_search_node_graph

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_search_node_graph(self):
     """Test the research of a node through a graph"""
     ent1 = BaseEntity('E1')
     ent2 = BaseEntity('E2')
     ent3 = BaseEntity('E3')
     ent4 = BaseEntity('E4')
     ent1.add_dep(ent2)
     ent1.add_dep(ent3)
     ent2.add_dep(ent4)
     ent3.add_dep(ent4)
     self.assertTrue(ent1.search('E3') is ent3)
     self.assertTrue(ent1.search('E5') is None)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:14,代码来源:BaseEntityTest.py

示例15: test_search_deps

# 需要导入模块: from MilkCheck.Engine.BaseEntity import BaseEntity [as 别名]
# 或者: from MilkCheck.Engine.BaseEntity.BaseEntity import add_dep [as 别名]
 def test_search_deps(self):
     """Test method search_deps"""
     ent = BaseEntity('test_service')
     ent_a = BaseEntity('A')
     ent_b = BaseEntity('B')
     ent.add_dep(ent_a)
     ent.add_dep(ent_b, CHECK)
     self.assertEqual(len(ent.search_deps()), 2)
     self.assertEqual(len(ent.search_deps([NO_STATUS])), 2)
     ent_c = BaseEntity('C')
     ent_c.status = DONE
     ent.add_dep(ent_c)
     self.assertEqual(len(ent.search_deps([NO_STATUS])), 2)
     self.assertEqual(len(ent.search_deps([NO_STATUS, DONE])), 3)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:16,代码来源:BaseEntityTest.py


注:本文中的MilkCheck.Engine.BaseEntity.BaseEntity.add_dep方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。