OP-2042 - added new fixture output_folder_url

Explicitly sets directory of published files. (Purges them if exist!)
This commit is contained in:
Petr Kalis 2021-12-10 15:08:13 +01:00
parent 6e9c9c087c
commit 9a0d55e2f3
4 changed files with 20 additions and 9 deletions

View file

@ -39,7 +39,7 @@ class TestPublishInMaya(PublishTest):
TIMEOUT = 120 # publish timeout
@pytest.fixture(scope="module")
def last_workfile_path(self, download_test_data):
def last_workfile_path(self, download_test_data, output_folder_url):
"""Get last_workfile_path from source data.
Maya expects workfile in proper folder, so copy is done first.
@ -48,7 +48,7 @@ class TestPublishInMaya(PublishTest):
"input",
"workfile",
"test_project_test_asset_TestTask_v001.mb")
dest_folder = os.path.join(download_test_data,
dest_folder = os.path.join(output_folder_url,
self.PROJECT,
self.ASSET,
"work",

View file

@ -52,7 +52,7 @@ class TestPublishInNuke(PublishTest):
"input",
"workfile",
source_file_name)
dest_folder = os.path.join(download_test_data,
dest_folder = os.path.join(output_folder_url,
self.PROJECT,
self.ASSET,
"work",

View file

@ -37,7 +37,7 @@ class TestPublishInPhotoshop(PublishTest):
TIMEOUT = 120 # publish timeout
@pytest.fixture(scope="module")
def last_workfile_path(self, download_test_data):
def last_workfile_path(self, download_test_data, output_folder_url):
"""Get last_workfile_path from source data.
Maya expects workfile in proper folder, so copy is done first.
@ -46,7 +46,7 @@ class TestPublishInPhotoshop(PublishTest):
"input",
"workfile",
"test_project_test_asset_TestTask_v001.psd")
dest_folder = os.path.join(download_test_data,
dest_folder = os.path.join(output_folder_url,
self.PROJECT,
self.ASSET,
"work",

View file

@ -215,7 +215,17 @@ class PublishTest(ModuleUnitTest):
yield "{}/{}".format(self.APP, app_variant)
@pytest.fixture(scope="module")
def last_workfile_path(self, download_test_data):
def output_folder_url(self, download_test_data):
"""Returns location of published data, cleans it first if exists."""
path = os.path.join(download_test_data, "output")
if os.path.exists(path):
print("Purging {}".format(path))
shutil.rmtree(path)
yield path
@pytest.fixture(scope="module")
def last_workfile_path(self, download_test_data, output_folder_url):
"""Returns url of workfile"""
raise NotImplementedError
@pytest.fixture(scope="module")
@ -251,15 +261,16 @@ class PublishTest(ModuleUnitTest):
@pytest.fixture(scope="module")
def launched_app(self, dbcon, download_test_data, last_workfile_path,
startup_scripts, app_args):
startup_scripts, app_args, app_name, output_folder_url):
"""Launch host app"""
# set publishing folders
root_key = "config.roots.work.{}".format("windows") # TEMP
platform_str = platform.system().lower()
root_key = "config.roots.work.{}".format(platform_str)
dbcon.update_one(
{"type": "project"},
{"$set":
{
root_key: download_test_data
root_key: output_folder_url
}}
)