From 5d9aaecea0e48938c3f3735d5b46c76ec932e8f3 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 21 Oct 2022 15:58:25 +0200 Subject: [PATCH] OP-3426 - fix output folder output_folder_url should be used, contains already 'output' subfolder --- tests/integration/hosts/aftereffects/lib.py | 3 +-- tests/integration/hosts/maya/lib.py | 1 - tests/integration/hosts/nuke/lib.py | 15 ++++++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/integration/hosts/aftereffects/lib.py b/tests/integration/hosts/aftereffects/lib.py index 0f7513c7d3..541103cb2e 100644 --- a/tests/integration/hosts/aftereffects/lib.py +++ b/tests/integration/hosts/aftereffects/lib.py @@ -20,8 +20,7 @@ class AEHostFixtures(HostFixtures): "input", "workfile", "test_project_test_asset_TestTask_v001.aep") - dest_folder = os.path.join(download_test_data, - "output", + dest_folder = os.path.join(output_folder_url, self.PROJECT, self.ASSET, "work", diff --git a/tests/integration/hosts/maya/lib.py b/tests/integration/hosts/maya/lib.py index a0c5214181..6610fac118 100644 --- a/tests/integration/hosts/maya/lib.py +++ b/tests/integration/hosts/maya/lib.py @@ -21,7 +21,6 @@ class MayaHostFixtures(HostFixtures): "workfile", "test_project_test_asset_TestTask_v001.mb") dest_folder = os.path.join(output_folder_url, - "output", self.PROJECT, self.ASSET, "work", diff --git a/tests/integration/hosts/nuke/lib.py b/tests/integration/hosts/nuke/lib.py index ed2af38d1c..564a5d3b88 100644 --- a/tests/integration/hosts/nuke/lib.py +++ b/tests/integration/hosts/nuke/lib.py @@ -1,6 +1,6 @@ import os import pytest -import shutil +import re from tests.lib.testing_classes import ( HostFixtures, @@ -15,7 +15,7 @@ class NukeHostFixtures(HostFixtures): """Get last_workfile_path from source data. """ - source_file_name = "test_project_test_asset_TestTask_v001.nk" + source_file_name = "test_project_test_asset_test_task_v001.nk" src_path = os.path.join(download_test_data, "input", "workfile", @@ -31,7 +31,16 @@ class NukeHostFixtures(HostFixtures): dest_path = os.path.join(dest_folder, source_file_name) - shutil.copy(src_path, dest_path) + # rewrite old root with temporary file + # TODO - using only C:/projects seems wrong - but where to get root ? + replace_pattern = re.compile(re.escape("C:/projects"), re.IGNORECASE) + with open(src_path, "r") as fp: + updated = fp.read() + updated = replace_pattern.sub(output_folder_url.replace("\\", '/'), + updated) + + with open(dest_path, "w") as fp: + fp.write(updated) yield dest_path