From f724e0ca222bd27d6a202ab7814fca449569830a Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 11 Mar 2022 13:33:17 +0100 Subject: [PATCH 01/13] OP-2813 - fix for rendering single file from AE in DL Solves issue with rendering .mov or .avi file. Added test cae for collect_frames --- openpype/lib/delivery.py | 21 +++++-- .../plugins/publish/submit_publish_job.py | 1 + tests/unit/openpype/lib/test_delivery.py | 57 +++++++++++++++++++ 3 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 tests/unit/openpype/lib/test_delivery.py diff --git a/openpype/lib/delivery.py b/openpype/lib/delivery.py index 9fc65aae8e..f1855d9550 100644 --- a/openpype/lib/delivery.py +++ b/openpype/lib/delivery.py @@ -13,18 +13,30 @@ def collect_frames(files): Uses clique as most precise solution Args: - files(list): list of source paths + files(list) or (set with single value): list of source paths Returns: (dict): {'/asset/subset_v001.0001.png': '0001', ....} """ collections, remainder = clique.assemble(files, minimum_items=1) + real_file_name = None + if len(files) == 1: + real_file_name = list(files)[0] + sources_and_frames = {} if collections: for collection in collections: src_head = collection.head src_tail = collection.tail + if src_head.endswith("_v"): + # print("Collection gathered incorrectly, not a sequence " + # "just a version found in {}".format(files)) + if len(collections) > 1: + continue + else: + return {real_file_name: None} + for index in collection.indexes: src_frame = collection.format("{padding}") % index src_file_name = "{}{}{}".format(src_head, src_frame, @@ -71,14 +83,15 @@ def path_from_representation(representation, anatomy): def copy_file(src_path, dst_path): """Hardlink file if possible(to save space), copy if not""" - from openpype.lib import create_hard_link # safer importing + from avalon.vendor import filelink # safer importing if os.path.exists(dst_path): return try: - create_hard_link( + filelink.create( src_path, - dst_path + dst_path, + filelink.HARDLINK ) except OSError: shutil.copyfile(src_path, dst_path) diff --git a/openpype/modules/deadline/plugins/publish/submit_publish_job.py b/openpype/modules/deadline/plugins/publish/submit_publish_job.py index 1de1c37575..964fe003fd 100644 --- a/openpype/modules/deadline/plugins/publish/submit_publish_job.py +++ b/openpype/modules/deadline/plugins/publish/submit_publish_job.py @@ -599,6 +599,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): "files": os.path.basename(remainder), "stagingDir": os.path.dirname(remainder), } + representations.append(rep) if "render" in instance.get("families"): rep.update({ "fps": instance.get("fps"), diff --git a/tests/unit/openpype/lib/test_delivery.py b/tests/unit/openpype/lib/test_delivery.py new file mode 100644 index 0000000000..affe14a89f --- /dev/null +++ b/tests/unit/openpype/lib/test_delivery.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +"""Test suite for delivery functions.""" +from openpype.lib.delivery import collect_frames + + +def test_collect_frames_multi_sequence(): + files = ["Asset_renderCompositingMain_v001.0000.png", + "Asset_renderCompositingMain_v001.0001.png", + "Asset_renderCompositingMain_v001.0002.png"] + ret = collect_frames(files) + + expected = { + "Asset_renderCompositingMain_v001.0000.png": "0000", + "Asset_renderCompositingMain_v001.0001.png": "0001", + "Asset_renderCompositingMain_v001.0002.png": "0002" + } + + print(ret) + assert ret == expected, "Not matching" + + +def test_collect_frames_single_sequence(): + files = ["Asset_renderCompositingMain_v001.0000.png"] + ret = collect_frames(files) + + expected = { + "Asset_renderCompositingMain_v001.0000.png": "0000" + } + + print(ret) + assert ret == expected, "Not matching" + + +def test_collect_frames_single_sequence_as_dict(): + files = {"Asset_renderCompositingMain_v001.0000.png"} + ret = collect_frames(files) + + expected = { + "Asset_renderCompositingMain_v001.0000.png": "0000" + } + + print(ret) + assert ret == expected, "Not matching" + + +def test_collect_frames_single_file(): + files = {"Asset_renderCompositingMain_v001.png"} + ret = collect_frames(files) + + expected = { + "Asset_renderCompositingMain_v001.png": None + } + + print(ret) + assert ret == expected, "Not matching" + + From 7ca997de92fd465d9c46b3473f3198a82dd84e2a Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 11 Mar 2022 14:14:47 +0100 Subject: [PATCH 02/13] OP-2813 - fix for rendering single file from AE in DL for sequence Solves issue with rendering single frame sequence, eg with 00000 in its file. --- .../publish/submit_aftereffects_deadline.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/openpype/modules/deadline/plugins/publish/submit_aftereffects_deadline.py b/openpype/modules/deadline/plugins/publish/submit_aftereffects_deadline.py index 2918b54d4a..c499c14d40 100644 --- a/openpype/modules/deadline/plugins/publish/submit_aftereffects_deadline.py +++ b/openpype/modules/deadline/plugins/publish/submit_aftereffects_deadline.py @@ -6,6 +6,7 @@ import pyblish.api from avalon import api from openpype.lib import env_value_to_bool +from openpype.lib.delivery import collect_frames from openpype_modules.deadline import abstract_submit_deadline from openpype_modules.deadline.abstract_submit_deadline import DeadlineJobInfo @@ -102,24 +103,18 @@ class AfterEffectsSubmitDeadline( def get_plugin_info(self): deadline_plugin_info = DeadlinePluginInfo() - context = self._instance.context - script_path = context.data["currentFile"] render_path = self._instance.data["expectedFiles"][0] - if len(self._instance.data["expectedFiles"]) > 1: + file_name, frame = list(collect_frames([render_path]).items())[0] + if frame: # replace frame ('000001') with Deadline's required '[#######]' # expects filename in format project_asset_subset_version.FRAME.ext render_dir = os.path.dirname(render_path) file_name = os.path.basename(render_path) - arr = file_name.split('.') - assert len(arr) == 3, \ - "Unable to parse frames from {}".format(file_name) - hashed = '[{}]'.format(len(arr[1]) * "#") - - render_path = os.path.join(render_dir, - '{}.{}.{}'.format(arr[0], hashed, - arr[2])) + hashed = '[{}]'.format(len(frame) * "#") + file_name = file_name.replace(frame, hashed) + render_path = os.path.join(render_dir, file_name) deadline_plugin_info.Comp = self._instance.data["comp_name"] deadline_plugin_info.Version = self._instance.data["app_version"] From 9de8504c4d89e800e4bff2b69376fe6f9f1f3eb2 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 11 Mar 2022 14:37:48 +0100 Subject: [PATCH 03/13] OP-2815 - Hound --- tests/unit/openpype/lib/test_delivery.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/openpype/lib/test_delivery.py b/tests/unit/openpype/lib/test_delivery.py index affe14a89f..7c2c92c101 100644 --- a/tests/unit/openpype/lib/test_delivery.py +++ b/tests/unit/openpype/lib/test_delivery.py @@ -54,4 +54,3 @@ def test_collect_frames_single_file(): print(ret) assert ret == expected, "Not matching" - From b46a7a538787e733f8d77a7cba89b7166bde133a Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 14 Mar 2022 10:49:48 +0100 Subject: [PATCH 04/13] OP-2813 - fix wrong merge --- openpype/lib/delivery.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openpype/lib/delivery.py b/openpype/lib/delivery.py index f1855d9550..5a69afd5aa 100644 --- a/openpype/lib/delivery.py +++ b/openpype/lib/delivery.py @@ -83,15 +83,14 @@ def path_from_representation(representation, anatomy): def copy_file(src_path, dst_path): """Hardlink file if possible(to save space), copy if not""" - from avalon.vendor import filelink # safer importing + from openpype.lib import create_hard_link # safer importing if os.path.exists(dst_path): return try: - filelink.create( + create_hard_link( src_path, - dst_path, - filelink.HARDLINK + dst_path ) except OSError: shutil.copyfile(src_path, dst_path) From 392963032732c8248b5c66d03b731d2ef5468237 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 14 Mar 2022 12:06:59 +0100 Subject: [PATCH 05/13] OP-2813 - fix hardcoded value Updated regular expression to match version substring to be more generic. --- openpype/lib/delivery.py | 12 ++++--- tests/unit/openpype/lib/test_delivery.py | 40 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/openpype/lib/delivery.py b/openpype/lib/delivery.py index 5a69afd5aa..ee21b01854 100644 --- a/openpype/lib/delivery.py +++ b/openpype/lib/delivery.py @@ -4,13 +4,18 @@ import shutil import glob import clique import collections +import re def collect_frames(files): """ Returns dict of source path and its frame, if from sequence - Uses clique as most precise solution + Uses clique as most precise solution, used when anatomy template that + created files is not known. + + Depends that version substring starts with 'v' with any number of + numeric characters after. Args: files(list) or (set with single value): list of source paths @@ -29,9 +34,8 @@ def collect_frames(files): src_head = collection.head src_tail = collection.tail - if src_head.endswith("_v"): - # print("Collection gathered incorrectly, not a sequence " - # "just a version found in {}".format(files)) + # version recognized as a collection + if re.match(".*([^a-zA-Z0-9]v%[0-9]+d).*", collection.format()): if len(collections) > 1: continue else: diff --git a/tests/unit/openpype/lib/test_delivery.py b/tests/unit/openpype/lib/test_delivery.py index 7c2c92c101..1787286032 100644 --- a/tests/unit/openpype/lib/test_delivery.py +++ b/tests/unit/openpype/lib/test_delivery.py @@ -19,6 +19,22 @@ def test_collect_frames_multi_sequence(): assert ret == expected, "Not matching" +def test_collect_frames_multi_sequence_different_format(): + files = ["Asset.v001.renderCompositingMain.0000.png", + "Asset.v001.renderCompositingMain.0001.png", + "Asset.v001.renderCompositingMain.0002.png"] + ret = collect_frames(files) + + expected = { + "Asset.v001.renderCompositingMain.0000.png": "0000", + "Asset.v001.renderCompositingMain.0001.png": "0001", + "Asset.v001.renderCompositingMain.0002.png": "0002" + } + + print(ret) + assert ret == expected, "Not matching" + + def test_collect_frames_single_sequence(): files = ["Asset_renderCompositingMain_v001.0000.png"] ret = collect_frames(files) @@ -31,6 +47,30 @@ def test_collect_frames_single_sequence(): assert ret == expected, "Not matching" +def test_collect_frames_single_sequence_different_format(): + files = ["Asset.v001.renderCompositingMain_0000.png"] + ret = collect_frames(files) + + expected = { + "Asset.v001.renderCompositingMain_0000.png": "0000" + } + + print(ret) + assert ret == expected, "Not matching" + + +def test_collect_frames_single_sequence_withhout_version(): + files = ["pngv001.renderCompositingMain_0000.png"] + ret = collect_frames(files) + + expected = { + "pngv001.renderCompositingMain_0000.png": "0000" + } + + print(ret) + assert ret == expected, "Not matching" + + def test_collect_frames_single_sequence_as_dict(): files = {"Asset_renderCompositingMain_v001.0000.png"} ret = collect_frames(files) From 78ae6c1c86ab5a8accce4906bf1eabf87ba4a607 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 16 Mar 2022 11:14:20 +0100 Subject: [PATCH 06/13] OP-2813 - fixed one too many frame after loaded clip in Nuke For 0-229 range it previously produced 229 - 0 + 1 = 230 (duration). last = 1 + 230 = 231 (should be 230). --- openpype/hosts/nuke/plugins/load/load_clip.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/nuke/plugins/load/load_clip.py b/openpype/hosts/nuke/plugins/load/load_clip.py index a253ba4a9d..ce1693f700 100644 --- a/openpype/hosts/nuke/plugins/load/load_clip.py +++ b/openpype/hosts/nuke/plugins/load/load_clip.py @@ -97,7 +97,7 @@ class LoadClip(plugin.NukeLoader): last += self.handle_end if not is_sequence: - duration = last - first + 1 + duration = last - first first = 1 last = first + duration elif "#" not in file: @@ -212,7 +212,7 @@ class LoadClip(plugin.NukeLoader): last += self.handle_end if not is_sequence: - duration = last - first + 1 + duration = last - first first = 1 last = first + duration elif "#" not in file: From 87b44b4b14c989c7dce61492650fb54202c37ee0 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 16 Mar 2022 13:48:50 +0100 Subject: [PATCH 07/13] OP-2813 - fix collect_frames when multiple version numbers in path Added new test case. --- openpype/lib/delivery.py | 8 +++----- tests/unit/openpype/lib/test_delivery.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/openpype/lib/delivery.py b/openpype/lib/delivery.py index ee21b01854..b9f3f0b106 100644 --- a/openpype/lib/delivery.py +++ b/openpype/lib/delivery.py @@ -25,10 +25,11 @@ def collect_frames(files): collections, remainder = clique.assemble(files, minimum_items=1) real_file_name = None + sources_and_frames = {} if len(files) == 1: real_file_name = list(files)[0] + sources_and_frames[real_file_name] = None - sources_and_frames = {} if collections: for collection in collections: src_head = collection.head @@ -36,10 +37,7 @@ def collect_frames(files): # version recognized as a collection if re.match(".*([^a-zA-Z0-9]v%[0-9]+d).*", collection.format()): - if len(collections) > 1: - continue - else: - return {real_file_name: None} + continue for index in collection.indexes: src_frame = collection.format("{padding}") % index diff --git a/tests/unit/openpype/lib/test_delivery.py b/tests/unit/openpype/lib/test_delivery.py index 1787286032..de87f99d79 100644 --- a/tests/unit/openpype/lib/test_delivery.py +++ b/tests/unit/openpype/lib/test_delivery.py @@ -47,6 +47,18 @@ def test_collect_frames_single_sequence(): assert ret == expected, "Not matching" +def test_collect_frames_single_sequence_full_path(): + files = ['C:/test_project/assets/locations/Town/work/compositing\\renders\\aftereffects\\test_project_TestAsset_compositing_v001\\TestAsset_renderCompositingMain_v001.mov'] # noqa: E501 + ret = collect_frames(files) + + expected = { + 'C:/test_project/assets/locations/Town/work/compositing\\renders\\aftereffects\\test_project_TestAsset_compositing_v001\\TestAsset_renderCompositingMain_v001.mov': None # noqa: E501 + } + + print(ret) + assert ret == expected, "Not matching" + + def test_collect_frames_single_sequence_different_format(): files = ["Asset.v001.renderCompositingMain_0000.png"] ret = collect_frames(files) From e208e7976d4f69207bedba5d55a0c925ac6e6b38 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 17 Mar 2022 14:57:28 +0100 Subject: [PATCH 08/13] OP-2813 - fixed duplication of representations nuke.api.plugin.ExporterReview adds representation explicitly via publish_on_farm, so skip adding repre if already there. (Issue in ExtractBurnin other way.) ExporterReview should be probably refactored and publish_on_farm removed altogether. --- .../deadline/plugins/publish/submit_publish_job.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/openpype/modules/deadline/plugins/publish/submit_publish_job.py b/openpype/modules/deadline/plugins/publish/submit_publish_job.py index b92fd2fe69..8c0d78cae5 100644 --- a/openpype/modules/deadline/plugins/publish/submit_publish_job.py +++ b/openpype/modules/deadline/plugins/publish/submit_publish_job.py @@ -601,13 +601,22 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): "files": os.path.basename(remainder), "stagingDir": os.path.dirname(remainder), } - representations.append(rep) if "render" in instance.get("families"): rep.update({ "fps": instance.get("fps"), "tags": ["review"] }) - self._solve_families(instance, True) + self._solve_families(instance, True) + + already_there = False + for repre in instance.get("representations", []): + # might be added explicitly before by publish_on_farm + already_there = repre.get("files") == rep["files"] + if already_there: + break + self.log.debug("repre {} already_there".format(repre)) + if not already_there: + representations.append(rep) return representations From 395d567aa2d7285e204ca6fb35a2344e0d7f2f94 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 17 Mar 2022 16:07:08 +0100 Subject: [PATCH 09/13] OP-2813 - fix wrong parsing when short label is used --- openpype/lib/delivery.py | 2 +- tests/unit/openpype/lib/test_delivery.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/openpype/lib/delivery.py b/openpype/lib/delivery.py index b9f3f0b106..78d743003b 100644 --- a/openpype/lib/delivery.py +++ b/openpype/lib/delivery.py @@ -36,7 +36,7 @@ def collect_frames(files): src_tail = collection.tail # version recognized as a collection - if re.match(".*([^a-zA-Z0-9]v%[0-9]+d).*", collection.format()): + if re.match(".*([a-zA-Z0-9]%[0-9]+d).*", collection.format()): continue for index in collection.indexes: diff --git a/tests/unit/openpype/lib/test_delivery.py b/tests/unit/openpype/lib/test_delivery.py index de87f99d79..871ea95df7 100644 --- a/tests/unit/openpype/lib/test_delivery.py +++ b/tests/unit/openpype/lib/test_delivery.py @@ -47,6 +47,30 @@ def test_collect_frames_single_sequence(): assert ret == expected, "Not matching" +def test_collect_frames_single_sequence_shot(): + files = ["testing_sh010_workfileCompositing_v001.aep"] + ret = collect_frames(files) + + expected = { + "testing_sh010_workfileCompositing_v001.aep": None + } + + print(ret) + assert ret == expected, "Not matching" + + +def test_collect_frames_single_sequence_shot_with_frame(): + files = ["testing_sh010_workfileCompositing_000_v001.aep"] + ret = collect_frames(files) + + expected = { + "testing_sh010_workfileCompositing_000_v001.aep": "000" + } + + print(ret) + assert ret == expected, "Not matching" + + def test_collect_frames_single_sequence_full_path(): files = ['C:/test_project/assets/locations/Town/work/compositing\\renders\\aftereffects\\test_project_TestAsset_compositing_v001\\TestAsset_renderCompositingMain_v001.mov'] # noqa: E501 ret = collect_frames(files) From d080b17cce56f6d128d45b26f9224db9294dcd5f Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 17 Mar 2022 18:00:25 +0100 Subject: [PATCH 10/13] OP-2813 - fix wrong logging --- .../modules/deadline/plugins/publish/submit_publish_job.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openpype/modules/deadline/plugins/publish/submit_publish_job.py b/openpype/modules/deadline/plugins/publish/submit_publish_job.py index 8c0d78cae5..06505b4b47 100644 --- a/openpype/modules/deadline/plugins/publish/submit_publish_job.py +++ b/openpype/modules/deadline/plugins/publish/submit_publish_job.py @@ -613,8 +613,9 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): # might be added explicitly before by publish_on_farm already_there = repre.get("files") == rep["files"] if already_there: + self.log.debug("repre {} already_there".format(repre)) break - self.log.debug("repre {} already_there".format(repre)) + if not already_there: representations.append(rep) From 5d25de8997c46c46ac2c6bdfeb36cf9e032266ec Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 18 Mar 2022 11:00:26 +0100 Subject: [PATCH 11/13] OP-2813 - added documentation how to run test file in IDE --- tests/README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/README.md b/tests/README.md index bb1cdbdef8..d0b537d425 100644 --- a/tests/README.md +++ b/tests/README.md @@ -21,3 +21,27 @@ Specific location could be provided to this command as an argument, either as ab (eg. `python ${OPENPYPE_ROOT}/start.py start.py runtests ../tests/integration`) will trigger only tests in `integration` folder. See `${OPENPYPE_ROOT}/cli.py:runtests` for other arguments. + +Run in IDE: +----------- +If you would prefer to run/debug single file dirrectly in IDE of your choice, you might encounter issues with imports. +It would manifest like `KeyError: 'OPENPYPE_DATABASE_NAME'`. That means you are importing module that depends on OP to be running, eg. all expected variables are set. + +In some cases your tests might be so localized, that you don't care about all env vars to be set properly. +In that case you might add this dummy configuration BEFORE any imports in your test file +``` +import os +os.environ["AVALON_MONGO"] = "mongodb://localhost:27017" +os.environ["OPENPYPE_MONGO"] = "mongodb://localhost:27017" +os.environ["AVALON_DB"] = "avalon" +os.environ["OPENPYPE_DATABASE_NAME"] = "openpype" +os.environ["AVALON_TIMEOUT"] = '3000' +os.environ["OPENPYPE_DEBUG"] = "3" +os.environ["AVALON_CONFIG"] = "pype" +os.environ["AVALON_ASSET"] = "Asset" +os.environ["AVALON_PROJECT"] = "test_project" +``` +(AVALON_ASSET and AVALON_PROJECT values should exist in your environment) + +This might be enough to run your test file separately. Do not commit this skeleton though. +Use only when you know what you are doing! \ No newline at end of file From c83202a023484aaa6a9a64aaab63ad879d71ded7 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 18 Mar 2022 11:13:10 +0100 Subject: [PATCH 12/13] OP-2813 - changed logic of parsing frames from names Adhering to clique standard FRAMES patter, eg pattern is separated by . It seems that this is most widely used (according to Discord). --- openpype/lib/delivery.py | 18 ++++---------- tests/unit/openpype/lib/test_delivery.py | 30 +++++++++++++++++++++--- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/openpype/lib/delivery.py b/openpype/lib/delivery.py index 78d743003b..03abe5802c 100644 --- a/openpype/lib/delivery.py +++ b/openpype/lib/delivery.py @@ -4,7 +4,6 @@ import shutil import glob import clique import collections -import re def collect_frames(files): @@ -14,31 +13,24 @@ def collect_frames(files): Uses clique as most precise solution, used when anatomy template that created files is not known. - Depends that version substring starts with 'v' with any number of - numeric characters after. + Assumption is that frames are separated by '.', negative frames are not + allowed. Args: files(list) or (set with single value): list of source paths Returns: (dict): {'/asset/subset_v001.0001.png': '0001', ....} """ - collections, remainder = clique.assemble(files, minimum_items=1) + patterns = [clique.PATTERNS["frames"]] + collections, remainder = clique.assemble(files, minimum_items=1, + patterns=patterns) - real_file_name = None sources_and_frames = {} - if len(files) == 1: - real_file_name = list(files)[0] - sources_and_frames[real_file_name] = None - if collections: for collection in collections: src_head = collection.head src_tail = collection.tail - # version recognized as a collection - if re.match(".*([a-zA-Z0-9]%[0-9]+d).*", collection.format()): - continue - for index in collection.indexes: src_frame = collection.format("{padding}") % index src_file_name = "{}{}{}".format(src_head, src_frame, diff --git a/tests/unit/openpype/lib/test_delivery.py b/tests/unit/openpype/lib/test_delivery.py index 871ea95df7..04a71655e3 100644 --- a/tests/unit/openpype/lib/test_delivery.py +++ b/tests/unit/openpype/lib/test_delivery.py @@ -47,6 +47,18 @@ def test_collect_frames_single_sequence(): assert ret == expected, "Not matching" +def test_collect_frames_single_sequence_negative(): + files = ["Asset_renderCompositingMain_v001.-0000.png"] + ret = collect_frames(files) + + expected = { + "Asset_renderCompositingMain_v001.-0000.png": None + } + + print(ret) + assert ret == expected, "Not matching" + + def test_collect_frames_single_sequence_shot(): files = ["testing_sh010_workfileCompositing_v001.aep"] ret = collect_frames(files) @@ -59,12 +71,24 @@ def test_collect_frames_single_sequence_shot(): assert ret == expected, "Not matching" +def test_collect_frames_single_sequence_numbers(): + files = ["PRJ_204_430_0005_renderLayoutMain_v001.0001.exr"] + ret = collect_frames(files) + + expected = { + "PRJ_204_430_0005_renderLayoutMain_v001.0001.exr": "0001" + } + + print(ret) + assert ret == expected, "Not matching" + + def test_collect_frames_single_sequence_shot_with_frame(): files = ["testing_sh010_workfileCompositing_000_v001.aep"] ret = collect_frames(files) expected = { - "testing_sh010_workfileCompositing_000_v001.aep": "000" + "testing_sh010_workfileCompositing_000_v001.aep": None } print(ret) @@ -88,7 +112,7 @@ def test_collect_frames_single_sequence_different_format(): ret = collect_frames(files) expected = { - "Asset.v001.renderCompositingMain_0000.png": "0000" + "Asset.v001.renderCompositingMain_0000.png": None } print(ret) @@ -100,7 +124,7 @@ def test_collect_frames_single_sequence_withhout_version(): ret = collect_frames(files) expected = { - "pngv001.renderCompositingMain_0000.png": "0000" + "pngv001.renderCompositingMain_0000.png": None } print(ret) From 55087ec5b849eb27496ea72c06fbdf5f55cb057d Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 18 Mar 2022 12:27:15 +0100 Subject: [PATCH 13/13] OP-2813 - fix typo --- tests/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/README.md b/tests/README.md index d0b537d425..69828cdbc2 100644 --- a/tests/README.md +++ b/tests/README.md @@ -24,7 +24,7 @@ See `${OPENPYPE_ROOT}/cli.py:runtests` for other arguments. Run in IDE: ----------- -If you would prefer to run/debug single file dirrectly in IDE of your choice, you might encounter issues with imports. +If you prefer to run/debug single file directly in IDE of your choice, you might encounter issues with imports. It would manifest like `KeyError: 'OPENPYPE_DATABASE_NAME'`. That means you are importing module that depends on OP to be running, eg. all expected variables are set. In some cases your tests might be so localized, that you don't care about all env vars to be set properly.