Esempio n. 1
0
 def test_implicit_loop(self):
     i1 = get_mock_item("type1", "name1", [], ["type1:name2"])
     i2 = get_mock_item("type1", "name2", [], ["type1:"])
     node = MagicMock()
     node.items = [i1, i2]
     with self.assertRaises(ItemDependencyError):
         list(apply_items(node))
Esempio n. 2
0
 def test_nested_loop(self):
     i1 = get_mock_item("type1", "name1", [], ["type1:name2"])
     i2 = get_mock_item("type1", "name2", [], ["type1:name3"])
     i3 = get_mock_item("type1", "name3", [], ["type1:name4"])
     i4 = get_mock_item("type1", "name4", [], ["type1:name1"])
     node = MagicMock()
     node.items = [i1, i2, i3, i4]
     with self.assertRaises(ItemDependencyError):
         list(apply_items(node))
Esempio n. 3
0
    def test_implicit_order(self):
        i1 = get_mock_item("type1", "name1", [], ["type1:name2"])
        i2 = get_mock_item("type1", "name2", [], [])
        i3 = get_mock_item("type2", "name3", ["type1:"], [])

        node = MagicMock()
        node.items = [i1, i2, i3]

        results = list(apply_items(node))

        self.assertEqual(results[0][0], "type1:name2")
        self.assertEqual(results[1][0], "type1:name1")
        self.assertEqual(results[2][0], "type2:name3")
Esempio n. 4
0
    def test_apply_interactive(self):
        i1 = get_mock_item("type1", "name1", [], ["type1:name2"])
        i2 = get_mock_item("type1", "name2", [], ["type1:name3"])
        i3 = get_mock_item("type1", "name3", [], [])

        node = MagicMock()
        node.items = [i1, i2, i3]

        results = list(apply_items(node, interactive=True, profiling=True))

        self.assertEqual(results[0][0], "type1:name3")
        self.assertEqual(results[1][0], "type1:name2")
        self.assertEqual(results[2][0], "type1:name1")
Esempio n. 5
0
    def test_apply_parallel(self):
        i1 = get_mock_item("type1", "name1", [], ["type1:name2"])
        i2 = get_mock_item("type1", "name2", [], ["type1:name3"])
        i3 = get_mock_item("type1", "name3", [], [])

        node = MagicMock()
        node.items = [i1, i2, i3]

        results = list(apply_items(node, workers=2))

        self.assertEqual(results[0][0], "type1:name3")
        self.assertEqual(results[1][0], "type1:name2")
        self.assertEqual(results[2][0], "type1:name1")