@@ -398,7 +398,6 @@ def test_flux_executor_submit_builds_jobspec_with_environment_and_gpus():
398398
399399 executor = object .__new__ (flux_executor .FluxExecutor )
400400 executor .flux_handle = object ()
401- executor .resources = None
402401 executor .platform_info = {}
403402 executor .workerID = 7
404403 executor .list_of_tasks = []
@@ -463,7 +462,6 @@ def test_flux_executor_init_connects_with_flux_uri():
463462
464463 fake_flux_module .Flux .assert_called_once_with ()
465464 assert executor .flux_handle == "flux-handle"
466- assert executor .resources is None
467465 assert executor .platform_info == {}
468466
469467
@@ -597,6 +595,52 @@ def test_flux_task_set_complete_handles_dry_run_and_return_codes():
597595 assert finished_task .success is False
598596 assert finished_task .state == "FAILED"
599597
598+ # cover waiting on a task that completes before timeout
599+ task = flux_executor .FluxTask (
600+ app = SimpleNamespace (name = "app" ),
601+ app_args = None ,
602+ workdir = os .getcwd (),
603+ stdout = "out.txt" ,
604+ stderr = "err.txt" ,
605+ workerid = 1 ,
606+ dry_run = False ,
607+ )
608+ task ._set_complete ()
609+ task .flux_jobid = 123
610+ task .wait (timeout = 10 )
611+ task .kill ()
612+
613+
614+ def test_flux_task_dry_run_exception_and_kill ():
615+ """Test FluxTask dry run exception attributes."""
616+ task = flux_executor .FluxTask (
617+ app = SimpleNamespace (name = "app" ),
618+ app_args = None ,
619+ workdir = os .getcwd (),
620+ stdout = "out.txt" ,
621+ stderr = "err.txt" ,
622+ workerid = 1 ,
623+ dry_run = True ,
624+ )
625+ task .wait ()
626+ assert task .finished is True
627+ assert task .success is True
628+ assert task .state == "FINISHED"
629+ task .kill ()
630+ task = flux_executor .FluxTask (
631+ app = SimpleNamespace (name = "app" ),
632+ app_args = None ,
633+ workdir = os .getcwd (),
634+ stdout = "out.txt" ,
635+ stderr = "err.txt" ,
636+ workerid = 1 ,
637+ dry_run = True ,
638+ )
639+ task .poll ()
640+ assert task .finished is True
641+ assert task .success is True
642+ assert task .state == "FINISHED"
643+
600644
601645def test_flux_task_wait_completes_and_times_out ():
602646 """Test FluxTask wait completes after polling and raises on timeout."""
@@ -716,6 +760,7 @@ def poll_side_effect():
716760 # Validator tests
717761 test_validator_accepts_flux ()
718762 test_validator_accepts_all_runners ()
763+ test_validator_rejects_invalid ()
719764
720765 # Platform tests
721766 test_flux_allocation_platform ()
@@ -724,4 +769,14 @@ def poll_side_effect():
724769 # EnvResources tests
725770 test_env_resources_flux_env_variable ()
726771
772+ # Flux Executor tests
773+ test_flux_executor_init_connects_with_flux_uri ()
774+ test_flux_executor_wait_on_start_polls_until_running ()
775+ test_flux_task_poll_maps_completion_waiting_and_unknown_states ()
776+ test_flux_task_handle_completion_success_and_failure ()
777+ test_flux_task_set_complete_handles_dry_run_and_return_codes ()
778+ test_flux_task_dry_run_exception_and_kill ()
779+ test_flux_task_wait_completes_and_times_out ()
780+ test_flux_task_kill_cancels_and_marks_user_killed ()
781+
727782 print ("All standalone tests passed!" )
0 commit comments