diff --git a/tests/job/test_genericJob.py b/tests/job/test_genericJob.py index 916735c2c..5d62a325c 100644 --- a/tests/job/test_genericJob.py +++ b/tests/job/test_genericJob.py @@ -518,13 +518,13 @@ def test_job_executor_run(self): def test_job_executor_cancel(self): j = self.project.create_job(ReturnCodeJob, "job_with_executor_cancel") j.input["accepted_codes"] = [1] - exe = ProcessPoolExecutor() + exe = ProcessPoolExecutor(max_workers=1) j.server.executor = exe self.assertTrue(j.server.run_mode.executor) - exe.submit(sleep, 1) # This part is a bit hacky, but it basically simulates other jobs on the same executor - j.run() + j.server.future = Future() j.server.future.cancel() j.refresh_job_status() + self.assertEqual(j.status, "aborted") self.assertTrue(j.status.aborted) def test_job_executor_wait(self):