From db729762b18f436908a889c65db5898c2ed94b34 Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Thu, 21 Nov 2024 18:40:58 +0100 Subject: [PATCH] test_asynchronuos_execution --- tests/transports/test_all_plugins.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/transports/test_all_plugins.py b/tests/transports/test_all_plugins.py index f54a659c0b..8abc6fef4b 100644 --- a/tests/transports/test_all_plugins.py +++ b/tests/transports/test_all_plugins.py @@ -1201,7 +1201,7 @@ def test_transfer_big_stdout(custom_transport, tmp_path): assert retcode == 0 -def test_asynchronous_execution(custom_transport): +def test_asynchronous_execution(custom_transport, tmp_path): """Test that the execution of a long(ish) command via the direct scheduler does not block. This is a regression test for #3094, where running a long job on the direct scheduler @@ -1220,10 +1220,10 @@ def test_asynchronous_execution(custom_transport): tmpf.write(b'#!/bin/bash\nsleep 10\n') tmpf.flush() - transport.putfile(tmpf.name, os.path.join('/tmp', script_fname)) + transport.putfile(tmpf.name, str(tmp_path / script_fname)) timestamp_before = time.time() - job_id_string = scheduler.submit_job('/tmp', script_fname) + job_id_string = scheduler.submit_job(str(tmp_path), script_fname) elapsed_time = time.time() - timestamp_before # We want to get back control. If it takes < 5 seconds, it means that it is not blocking @@ -1259,9 +1259,3 @@ def test_asynchronous_execution(custom_transport): # If the process is already dead (or has never run), I just ignore the error pass - # Also remove the script - try: - transport.remove(f'/tmp/{script_fname}') - except FileNotFoundError: - # If the file wasn't even created, I just ignore this error - pass