88import sys
99from pathlib import Path
1010
11- from cosmotech .orchestrator .core .step import Step
11+ from cosmotech .orchestrator .core .step import Step , StepStatus
1212from cosmotech .orchestrator .core .environment import EnvironmentVariable
1313from cosmotech .orchestrator .templates .library import Library
1414
@@ -203,8 +203,8 @@ def test_run_successful_command(self, mock_remove, mock_popen, mock_temp_file):
203203 result = step .run ()
204204
205205 # Verify
206- assert result == "Done"
207- assert step .status == "Done"
206+ assert result == StepStatus . SUCCESS
207+ assert step .status == StepStatus . SUCCESS
208208 assert "output1" in step .captured_output
209209 assert step .captured_output ["output1" ] == "value1"
210210 mock_temp_file .assert_called_once ()
@@ -233,8 +233,8 @@ def test_run_command_with_error(self, mock_remove, mock_popen, mock_temp_file):
233233 result = step .run ()
234234
235235 # Verify
236- assert result == "RunError"
237- assert step .status == "RunError"
236+ assert result == StepStatus . ERROR
237+ assert step .status == StepStatus . ERROR
238238 mock_temp_file .assert_called_once ()
239239 mock_popen .assert_called_once ()
240240 mock_remove .assert_called_once_with ("/tmp/test_file" )
@@ -247,8 +247,8 @@ def test_run_with_dry_run(self):
247247 result = step .run (dry = True )
248248
249249 # Verify
250- assert result == "DryRun"
251- assert step .status == "DryRun"
250+ assert result == StepStatus . DRY_RUN
251+ assert step .status == StepStatus . DRY_RUN
252252
253253 def test_run_with_skipped_step (self ):
254254 # Setup
@@ -259,19 +259,19 @@ def test_run_with_skipped_step(self):
259259 result = step .run ()
260260
261261 # Verify
262- assert result == "Done"
263- assert step .status == "Done"
262+ assert result == StepStatus . SKIPPED_BY_USER
263+ assert step .status == StepStatus . SKIPPED_BY_USER
264264
265265 def test_run_with_previous_errors (self ):
266266 # Setup
267267 step = Step (id = "test-step" , command = "echo" , arguments = ["Hello" , "World" ])
268268
269269 # Execute
270- result = step .run (previous = {"step1" : "RunError" })
270+ result = step .run (previous = {"step1" : StepStatus . ERROR })
271271
272272 # Verify
273- assert result == "Skipped"
274- assert step .status == "Skipped"
273+ assert result == StepStatus . SKIPPED_AFTER_FAILURE
274+ assert step .status == StepStatus . SKIPPED_AFTER_FAILURE
275275
276276 @patch ("tempfile.NamedTemporaryFile" )
277277 @patch ("subprocess.Popen" )
@@ -300,7 +300,7 @@ def test_run_with_input_data(self, mock_remove, mock_popen, mock_temp_file):
300300 result = step .run (input_data = {"input1" : "input_value1" })
301301
302302 # Verify
303- assert result == "Done"
303+ assert result == StepStatus . SUCCESS
304304 mock_popen .assert_called_once ()
305305 # Check that environment variables were set correctly
306306 env = mock_popen .call_args [1 ]["env" ]
@@ -352,7 +352,7 @@ def test_run_with_default_input_value(self, mock_remove, mock_popen, mock_temp_f
352352 result = step .run (input_data = {})
353353
354354 # Verify
355- assert result == "Done"
355+ assert result == StepStatus . SUCCESS
356356 # Check that environment variables were set correctly
357357 env = mock_popen .call_args [1 ]["env" ]
358358 assert "INPUT_VAR1" in env
@@ -397,14 +397,14 @@ def test_check_env_returns_empty_dict_for_skipped_step(self):
397397 def test_simple_repr (self ):
398398 # Setup
399399 step = Step (id = "test-step" , command = "echo" , description = "Test step" )
400- step .status = "Done"
400+ step .status = StepStatus . SUCCESS
401401
402402 # Execute
403403 result = step .simple_repr ()
404404
405405 # Verify
406406 assert "test-step" in result
407- assert "Done" in result
407+ assert StepStatus . SUCCESS . name in result
408408 assert "Test step" in result
409409
410410 def test_str_representation (self ):
@@ -417,7 +417,7 @@ def test_str_representation(self):
417417 environment = {"TEST_VAR" : {"value" : "test_value" , "description" : "Test var" }},
418418 useSystemEnvironment = True ,
419419 )
420- step .status = "Done"
420+ step .status = StepStatus . SUCCESS
421421
422422 # Execute
423423 result = str (step )
@@ -428,7 +428,7 @@ def test_str_representation(self):
428428 assert "Test step" in result
429429 assert "TEST_VAR" in result
430430 assert "Test var" in result
431- assert "Done" in result
431+ assert StepStatus . SUCCESS . name in result
432432
433433
434434class TestOutputParser :
0 commit comments