Skip to content

Commit cac36e1

Browse files
author
Alan Christie
committed
fix: Attempt to fix execution directory clearing
1 parent bb07782 commit cac36e1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/instance_launcher.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ def __init__(
6060
# Every launcher starts with an empty execution directory...
6161
print(f"Removing execution directory ({EXECUTION_DIRECTORY})")
6262
assert EXECUTION_DIRECTORY.startswith("tests/project-root")
63-
for filename in os.listdir(EXECUTION_DIRECTORY):
64-
file_path = os.path.join(EXECUTION_DIRECTORY, filename)
65-
if os.path.isfile(file_path) or os.path.islink(file_path):
66-
os.unlink(file_path)
67-
elif os.path.isdir(file_path):
68-
shutil.rmtree(file_path)
63+
if os.path.isdir(EXECUTION_DIRECTORY):
64+
for filename in os.listdir(EXECUTION_DIRECTORY):
65+
file_path = os.path.join(EXECUTION_DIRECTORY, filename)
66+
if os.path.isfile(file_path) or os.path.islink(file_path):
67+
os.unlink(file_path)
68+
elif os.path.isdir(file_path):
69+
shutil.rmtree(file_path)
6970

7071
def launch(self, launch_parameters: LaunchParameters) -> LaunchResult:
7172
assert launch_parameters

0 commit comments

Comments
 (0)