@@ -55,29 +55,27 @@ def test_sequencer_builds_steps_from_dependency_graph(ws, simple_dependency_reso
55
55
job = jobs .Job (job_id = 1234 , settings = settings )
56
56
ws .jobs .get .return_value = job
57
57
ws_cache = create_autospec (WorkspaceCache )
58
- ws_cache .get_workspace_path .side_effect = lambda path : Path ( path )
58
+ ws_cache .get_workspace_path .side_effect = Path
59
59
dependency = WorkflowTask (ws , task , job , ws_cache )
60
60
container = dependency .load (mock_path_lookup )
61
61
graph = DependencyGraph (dependency , None , simple_dependency_resolver , mock_path_lookup , CurrentSessionState ())
62
62
problems = container .build_dependency_graph (graph )
63
63
assert not problems
64
64
sequencer = MigrationSequencer (ws , mock_path_lookup , admin_locator (ws , "John Doe" ))
65
65
sequencer .register_workflow_task (task , job , graph )
66
- steps = list (sequencer .generate_steps ())
67
- step0 = next ((step for step in steps if step .object_type == "TASK" ), None )
68
- assert step0
69
- step1 = next ((step for step in steps if step .object_name == notebook_path .as_posix ()), None )
70
- assert step1
71
- assert step1 .step_number < step0 .step_number
72
- step2 = next (
73
- (step for step in steps if step .object_name == "parent_that_magic_runs_child_that_uses_value_from_parent.py" ),
74
- None ,
75
- )
76
- assert step2
77
- assert step2 .step_number < step1 .step_number
78
- step3 = next ((step for step in steps if step .object_name == "_child_that_uses_value_from_parent.py" ), None )
79
- assert step3
80
- assert step3 .step_number < step2 .step_number
66
+ all_steps = list (sequencer .generate_steps ())
67
+ # ensure steps have a consistent step_number: TASK > grand-parent > parent > child
68
+ parent_name = "parent_that_magic_runs_child_that_uses_value_from_parent.py"
69
+ steps = [
70
+ next ((step for step in all_steps if step .object_name == "_child_that_uses_value_from_parent.py" ), None ),
71
+ next ((step for step in all_steps if step .object_name == parent_name ), None ),
72
+ next ((step for step in all_steps if step .object_name == notebook_path .as_posix ()), None ),
73
+ next ((step for step in all_steps if step .object_type == "TASK" ), None ),
74
+ ]
75
+ # ensure steps have a consistent step_number
76
+ for i in range (0 , len (steps ) - 1 ):
77
+ assert steps [i ]
78
+ assert steps [i ].step_number < steps [i + 1 ].step_number
81
79
82
80
83
81
class _DependencyGraph (DependencyGraph ):
0 commit comments