From 3ac45f0867dd893d5d78abc9c7a980749f442459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Or=C5=82owski?= Date: Tue, 23 Jun 2026 14:01:04 +0200 Subject: [PATCH] swap_dir fix for model reload --- tests/functional/utils/test_framework.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/functional/utils/test_framework.py b/tests/functional/utils/test_framework.py index f991757b22..26efff66f7 100644 --- a/tests/functional/utils/test_framework.py +++ b/tests/functional/utils/test_framework.py @@ -294,14 +294,15 @@ def swap_directory(target_path, staging_path, backup_path=None): old_path = target_path + "_old" if os.path.exists(old_path): remove_dir_tree(old_path) - target_moved = False + parent_dir = os.path.dirname(target_path) + if parent_dir: + os.makedirs(parent_dir, exist_ok=True) if os.path.exists(target_path): os.rename(target_path, old_path) - target_moved = True try: os.rename(staging_path, target_path) except OSError: - if target_moved and os.path.exists(old_path) and not os.path.exists(target_path): + if os.path.exists(old_path) and not os.path.exists(target_path): try: os.rename(old_path, target_path) except OSError: