OP-3426 - fix output folder

output_folder_url should be used, contains already 'output' subfolder
This commit is contained in:
Petr Kalis 2022-10-21 15:58:25 +02:00
parent 7e6c355fea
commit 5d9aaecea0
3 changed files with 13 additions and 6 deletions

View file

@ -20,8 +20,7 @@ class AEHostFixtures(HostFixtures):
"input", "input",
"workfile", "workfile",
"test_project_test_asset_TestTask_v001.aep") "test_project_test_asset_TestTask_v001.aep")
dest_folder = os.path.join(download_test_data, dest_folder = os.path.join(output_folder_url,
"output",
self.PROJECT, self.PROJECT,
self.ASSET, self.ASSET,
"work", "work",

View file

@ -21,7 +21,6 @@ class MayaHostFixtures(HostFixtures):
"workfile", "workfile",
"test_project_test_asset_TestTask_v001.mb") "test_project_test_asset_TestTask_v001.mb")
dest_folder = os.path.join(output_folder_url, dest_folder = os.path.join(output_folder_url,
"output",
self.PROJECT, self.PROJECT,
self.ASSET, self.ASSET,
"work", "work",

View file

@ -1,6 +1,6 @@
import os import os
import pytest import pytest
import shutil import re
from tests.lib.testing_classes import ( from tests.lib.testing_classes import (
HostFixtures, HostFixtures,
@ -15,7 +15,7 @@ class NukeHostFixtures(HostFixtures):
"""Get last_workfile_path from source data. """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, src_path = os.path.join(download_test_data,
"input", "input",
"workfile", "workfile",
@ -31,7 +31,16 @@ class NukeHostFixtures(HostFixtures):
dest_path = os.path.join(dest_folder, dest_path = os.path.join(dest_folder,
source_file_name) 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 yield dest_path