summaryrefslogtreecommitdiff
path: root/ick2/buildgraph_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'ick2/buildgraph_tests.py')
-rw-r--r--ick2/buildgraph_tests.py43
1 files changed, 22 insertions, 21 deletions
diff --git a/ick2/buildgraph_tests.py b/ick2/buildgraph_tests.py
index e661294..53c9e74 100644
--- a/ick2/buildgraph_tests.py
+++ b/ick2/buildgraph_tests.py
@@ -35,7 +35,7 @@ class BuildGraphTests(unittest.TestCase):
},
'2': {
'action': {'action': 'bar'},
- 'status': 'blocked',
+ 'status': ick2.ACTION_BLOCKED,
'depends': ['1'],
},
}
@@ -55,7 +55,7 @@ class BuildGraphTests(unittest.TestCase):
{
action_id: {
'action': {'action': 'foo'},
- 'status': 'ready',
+ 'status': ick2.ACTION_READY,
'depends': []
}
}
@@ -80,12 +80,12 @@ class BuildGraphTests(unittest.TestCase):
{
action_id1: {
'action': {'action': 'foo'},
- 'status': 'ready',
+ 'status': ick2.ACTION_READY,
'depends': [],
},
action_id2: {
'action': {'action': 'bar'},
- 'status': 'blocked',
+ 'status': ick2.ACTION_BLOCKED,
'depends': [action_id1],
},
}
@@ -98,10 +98,11 @@ class BuildGraphTests(unittest.TestCase):
graph = ick2.BuildGraph()
action_id = graph.append_action(action)
- self.assertEqual(graph.get_action_status(action_id), 'ready')
+ self.assertEqual(graph.get_action_status(action_id), ick2.ACTION_READY)
- graph.set_action_status(action_id, 'building')
- self.assertEqual(graph.get_action_status(action_id), 'building')
+ graph.set_action_status(action_id, ick2.ACTION_BUILDING)
+ self.assertEqual(
+ graph.get_action_status(action_id), ick2.ACTION_BUILDING)
def test_appends_pipeline_actions(self):
pipeline_as_dict = {
@@ -123,12 +124,12 @@ class BuildGraphTests(unittest.TestCase):
'1': {
'action': {'action': 'foo'},
'depends': [],
- 'status': 'ready',
+ 'status': ick2.ACTION_READY,
},
'2': {
'action': {'action': 'bar'},
'depends': ['1'],
- 'status': 'blocked',
+ 'status': ick2.ACTION_BLOCKED,
},
}
)
@@ -163,8 +164,8 @@ class BuildGraphTests(unittest.TestCase):
graph.append_pipeline(pipeline)
self.assertEqual(graph.find_actions('no-such-state'), [])
- self.assertEqual(graph.find_actions('ready'), ['1'])
- self.assertEqual(graph.find_actions('blocked'), ['2'])
+ self.assertEqual(graph.find_actions(ick2.ACTION_READY), ['1'])
+ self.assertEqual(graph.find_actions(ick2.ACTION_BLOCKED), ['2'])
def test_tracks_nothing_to_do(self):
pipeline_as_dict = {
@@ -198,18 +199,18 @@ class BuildGraphTests(unittest.TestCase):
self.assertFalse(graph.has_more_to_do())
graph.append_pipeline(pipeline)
- graph.set_action_status('1', 'building')
- self.assertEqual(graph.get_action_status('2'), 'blocked')
+ graph.set_action_status('1', ick2.ACTION_BUILDING)
+ self.assertEqual(graph.get_action_status('2'), ick2.ACTION_BLOCKED)
self.assertTrue(graph.has_more_to_do())
- graph.set_action_status('1', 'done')
- self.assertEqual(graph.get_action_status('2'), 'blocked')
- self.assertTrue(graph.has_more_to_do())
+ graph.set_action_status('1', ick2.ACTION_DONE)
+ self.assertEqual(graph.get_action_status('2'), ick2.ACTION_BLOCKED)
+ self.assertFalse(graph.has_more_to_do())
- graph.set_action_status('2', 'ready')
+ graph.set_action_status('2', ick2.ACTION_READY)
self.assertTrue(graph.has_more_to_do())
- graph.set_action_status('2', 'done')
+ graph.set_action_status('2', ick2.ACTION_DONE)
self.assertFalse(graph.has_more_to_do())
def test_unblocks_when_deps_are_done(self):
@@ -227,7 +228,7 @@ class BuildGraphTests(unittest.TestCase):
graph = ick2.BuildGraph()
graph.append_pipeline(pipeline)
- graph.set_action_status('1', 'done')
+ graph.set_action_status('1', ick2.ACTION_DONE)
graph.unblock()
- self.assertEqual(graph.get_action_status('1'), 'done')
- self.assertEqual(graph.get_action_status('2'), 'ready')
+ self.assertEqual(graph.get_action_status('1'), ick2.ACTION_DONE)
+ self.assertEqual(graph.get_action_status('2'), ick2.ACTION_READY)