From fabfaac3f56df68e7096402f9223623ce6e35e58 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 16 Nov 2021 09:43:42 +0100 Subject: [PATCH 01/15] OP-2019 - extracted headless_publish function to lib --- openpype/lib/remote_publish.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/openpype/lib/remote_publish.py b/openpype/lib/remote_publish.py index f7d7955b79..79b130913f 100644 --- a/openpype/lib/remote_publish.py +++ b/openpype/lib/remote_publish.py @@ -11,6 +11,21 @@ from openpype.lib.mongo import OpenPypeMongoConnection from openpype.lib.plugin_tools import parse_json +def headless_publish(log): + """Runs publish in a opened host with a context and closes Python process. + + Host is being closed via ClosePS pyblish plugin which triggers 'exit' + method in ConsoleTrayApp. + """ + dbcon = get_webpublish_conn() + _id = os.environ.get("BATCH_LOG_ID") + if not _id: + log.warning("Unable to store log records, batch will be unfinished!") + return + + publish_and_log(dbcon, _id, log, 'CloseAE') + + def get_webpublish_conn(): """Get connection to OP 'webpublishes' collection.""" mongo_client = OpenPypeMongoConnection.get_mongo_client() From 939eabfc41f6e284c826cd225fc718865bf952cf Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 16 Nov 2021 09:44:16 +0100 Subject: [PATCH 02/15] OP-2019 - remote publish needs to have order of methods flipped --- .../hosts/aftereffects/plugins/publish/extract_local_render.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openpype/hosts/aftereffects/plugins/publish/extract_local_render.py b/openpype/hosts/aftereffects/plugins/publish/extract_local_render.py index 37337e7fee..b36ab24bde 100644 --- a/openpype/hosts/aftereffects/plugins/publish/extract_local_render.py +++ b/openpype/hosts/aftereffects/plugins/publish/extract_local_render.py @@ -19,10 +19,9 @@ class ExtractLocalRender(openpype.api.Extractor): staging_dir = instance.data["stagingDir"] self.log.info("staging_dir::{}".format(staging_dir)) - stub.render(staging_dir) - # pull file name from Render Queue Output module render_q = stub.get_render_info() + stub.render(staging_dir) if not render_q: raise ValueError("No file extension set in Render Queue") _, ext = os.path.splitext(os.path.basename(render_q.file_name)) From 6b45101ed087e8a49d59a8efa01477a6e725a120 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 16 Nov 2021 09:44:49 +0100 Subject: [PATCH 03/15] OP-2019 - added test classes for remote publish --- .../aftereffects/plugins/publish/closeAE.py | 29 ++++++ .../test_publish_in_aftereffects.py | 96 +++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 openpype/hosts/aftereffects/plugins/publish/closeAE.py create mode 100644 tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py diff --git a/openpype/hosts/aftereffects/plugins/publish/closeAE.py b/openpype/hosts/aftereffects/plugins/publish/closeAE.py new file mode 100644 index 0000000000..e6e9623474 --- /dev/null +++ b/openpype/hosts/aftereffects/plugins/publish/closeAE.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +"""Close AE after publish. For Webpublishing only.""" +import os + +import pyblish.api + +from avalon import aftereffects + + +class CloseAE(pyblish.api.ContextPlugin): + """Close AE after publish. For Webpublishing only. + """ + + order = pyblish.api.IntegratorOrder + 14 + label = "Close AE" + optional = True + active = True + + hosts = ["aftereffects"] + targets = ["remotepublish"] + + def process(self, context): + self.log.info("CloseAE") + + stub = aftereffects.stub() + self.log.info("Shutting down AE") + stub.save() + stub.close() + self.log.info("AE closed") diff --git a/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py b/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py new file mode 100644 index 0000000000..f709e40120 --- /dev/null +++ b/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py @@ -0,0 +1,96 @@ +import pytest +import os +import shutil + +from tests.lib.testing_classes import PublishTest + + +class TestPublishInAfterEffects(PublishTest): + """Basic test case for publishing in AfterEffects + + Uses generic TestCase to prepare fixtures for test data, testing DBs, + env vars. + + Opens AfterEffects, run publish on prepared workile. + + Then checks content of DB (if subset, version, representations were + created. + Checks tmp folder if all expected files were published. + + """ + PERSIST = True + + TEST_FILES = [ + ("1qsrq6OJWVpOeXE2LTWrdbsLqEVu155Uf", + "test_aftereffects_publish.zip", + "") + ] + + APP = "aftereffects" + APP_VARIANT = "2021" + + APP_NAME = "{}/{}".format(APP, APP_VARIANT) + + TIMEOUT = 120 # publish timeout + + @pytest.fixture(scope="module") + def last_workfile_path(self, download_test_data): + """Get last_workfile_path from source data. + + Maya expects workfile in proper folder, so copy is done first. + """ + src_path = os.path.join(download_test_data, + "input", + "workfile", + "test_project_test_asset_TestTask_v001.aep") + dest_folder = os.path.join(download_test_data, + self.PROJECT, + self.ASSET, + "work", + self.TASK) + os.makedirs(dest_folder) + dest_path = os.path.join(dest_folder, + "test_project_test_asset_TestTask_v001.aep") + shutil.copy(src_path, dest_path) + + yield dest_path + + @pytest.fixture(scope="module") + def startup_scripts(self, monkeypatch_session, download_test_data): + """Points AfterEffects to userSetup file from input data""" + os.environ["HEADLESS_PUBLISH"] = "true" + + def test_db_asserts(self, dbcon, publish_finished): + """Host and input data dependent expected results in DB.""" + print("test_db_asserts") + assert 5 == dbcon.count_documents({"type": "version"}), \ + "Not expected no of versions" + + assert 0 == dbcon.count_documents({"type": "version", + "name": {"$ne": 1}}), \ + "Only versions with 1 expected" + + assert 1 == dbcon.count_documents({"type": "subset", + "name": "modelMain"}), \ + "modelMain subset must be present" + + assert 1 == dbcon.count_documents({"type": "subset", + "name": "workfileTest_task"}), \ + "workfileTest_task subset must be present" + + assert 11 == dbcon.count_documents({"type": "representation"}), \ + "Not expected no of representations" + + assert 2 == dbcon.count_documents({"type": "representation", + "context.subset": "modelMain", + "context.ext": "abc"}), \ + "Not expected no of representations with ext 'abc'" + + assert 2 == dbcon.count_documents({"type": "representation", + "context.subset": "modelMain", + "context.ext": "ma"}), \ + "Not expected no of representations with ext 'abc'" + + +if __name__ == "__main__": + test_case = TestPublishInAfterEffects() From af1a06c00052743f928cbe67d75ce448bc86fe6d Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 18 Nov 2021 18:02:06 +0100 Subject: [PATCH 04/15] OP-2019 - bump up version of PS --- tests/integration/hosts/photoshop/test_publish_in_photoshop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/hosts/photoshop/test_publish_in_photoshop.py b/tests/integration/hosts/photoshop/test_publish_in_photoshop.py index 396468a966..3fdfce7cc0 100644 --- a/tests/integration/hosts/photoshop/test_publish_in_photoshop.py +++ b/tests/integration/hosts/photoshop/test_publish_in_photoshop.py @@ -25,7 +25,7 @@ class TestPublishInPhotoshop(PublishTest): ] APP = "photoshop" - APP_VARIANT = "2020" + APP_VARIANT = "2021" APP_NAME = "{}/{}".format(APP, APP_VARIANT) From 04fd46f9e91e6b42089957581c25b18ad51062b0 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 18 Nov 2021 18:02:42 +0100 Subject: [PATCH 05/15] OP-2019 - added AE 2022 --- .../defaults/system_settings/applications.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/openpype/settings/defaults/system_settings/applications.json b/openpype/settings/defaults/system_settings/applications.json index cc80a94d3f..8c119658be 100644 --- a/openpype/settings/defaults/system_settings/applications.json +++ b/openpype/settings/defaults/system_settings/applications.json @@ -1098,6 +1098,23 @@ "linux": [] }, "environment": {} + }, + "2022": { + "enabled": true, + "variant_label": "2022", + "executables": { + "windows": [ + "C:\\Program Files\\Adobe\\Adobe After Effects 2022\\Support Files\\AfterFX.exe" + ], + "darwin": [], + "linux": [] + }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, + "environment": {} } } }, From 1369098454ac40bc474283706e6508d756dd8bcb Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 18 Nov 2021 18:07:07 +0100 Subject: [PATCH 06/15] OP-2019 - added IS_TEST env var Used to differentiate between regular REMOTE_PUBLISH and automatic tests --- tests/integration/hosts/photoshop/test_publish_in_photoshop.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/hosts/photoshop/test_publish_in_photoshop.py b/tests/integration/hosts/photoshop/test_publish_in_photoshop.py index 3fdfce7cc0..f8be8599ee 100644 --- a/tests/integration/hosts/photoshop/test_publish_in_photoshop.py +++ b/tests/integration/hosts/photoshop/test_publish_in_photoshop.py @@ -57,6 +57,7 @@ class TestPublishInPhotoshop(PublishTest): def startup_scripts(self, monkeypatch_session, download_test_data): """Points Maya to userSetup file from input data""" os.environ["IS_HEADLESS"] = "true" + os.environ["IS_TEST"] = "true" def test_db_asserts(self, dbcon, publish_finished): """Host and input data dependent expected results in DB.""" From 30e39bebabc7352bcc998850931a58b7bc95ec65 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 18 Nov 2021 18:15:08 +0100 Subject: [PATCH 07/15] OP-2019 - removed setting env vars in class Necessary env vars should be configured in testing zip file --- tests/integration/hosts/photoshop/test_publish_in_photoshop.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/hosts/photoshop/test_publish_in_photoshop.py b/tests/integration/hosts/photoshop/test_publish_in_photoshop.py index f8be8599ee..b634d422f3 100644 --- a/tests/integration/hosts/photoshop/test_publish_in_photoshop.py +++ b/tests/integration/hosts/photoshop/test_publish_in_photoshop.py @@ -56,8 +56,7 @@ class TestPublishInPhotoshop(PublishTest): @pytest.fixture(scope="module") def startup_scripts(self, monkeypatch_session, download_test_data): """Points Maya to userSetup file from input data""" - os.environ["IS_HEADLESS"] = "true" - os.environ["IS_TEST"] = "true" + pass def test_db_asserts(self, dbcon, publish_finished): """Host and input data dependent expected results in DB.""" From 35153fca3ae5d83a64334f9bda14bcd40e011a60 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 18 Nov 2021 18:16:56 +0100 Subject: [PATCH 08/15] OP-2019 - added working test case for After Effects --- .../hosts/aftereffects/test_publish_in_aftereffects.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py b/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py index f709e40120..d4e88dfd4c 100644 --- a/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py +++ b/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py @@ -58,7 +58,7 @@ class TestPublishInAfterEffects(PublishTest): @pytest.fixture(scope="module") def startup_scripts(self, monkeypatch_session, download_test_data): """Points AfterEffects to userSetup file from input data""" - os.environ["HEADLESS_PUBLISH"] = "true" + pass def test_db_asserts(self, dbcon, publish_finished): """Host and input data dependent expected results in DB.""" From 7456d0c3805f7d26e867ba46a08c75ccef97e632 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 18 Nov 2021 18:17:21 +0100 Subject: [PATCH 09/15] OP-2019 - added remote publishing method for automatic tests --- openpype/lib/remote_publish.py | 45 ++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/openpype/lib/remote_publish.py b/openpype/lib/remote_publish.py index 79b130913f..3483898af7 100644 --- a/openpype/lib/remote_publish.py +++ b/openpype/lib/remote_publish.py @@ -11,19 +11,23 @@ from openpype.lib.mongo import OpenPypeMongoConnection from openpype.lib.plugin_tools import parse_json -def headless_publish(log): +def headless_publish(log, close_plugin_name=None, is_test=False): """Runs publish in a opened host with a context and closes Python process. Host is being closed via ClosePS pyblish plugin which triggers 'exit' method in ConsoleTrayApp. """ - dbcon = get_webpublish_conn() - _id = os.environ.get("BATCH_LOG_ID") - if not _id: - log.warning("Unable to store log records, batch will be unfinished!") - return + if not is_test: + dbcon = get_webpublish_conn() + _id = os.environ.get("BATCH_LOG_ID") + if not _id: + log.warning("Unable to store log records, " + "batch will be unfinished!") + return - publish_and_log(dbcon, _id, log, 'CloseAE') + publish_and_log(dbcon, _id, log, close_plugin_name) + else: + publish(log, 'CloseAE') def get_webpublish_conn(): @@ -51,6 +55,33 @@ def start_webpublish_log(dbcon, batch_id, user): }).inserted_id +def publish(log, close_plugin_name=None): + """Loops through all plugins, logs to console. Used for tests. + + Args: + log (OpenPypeLogger) + close_plugin_name (str): name of plugin with responsibility to + close host app + """ + # Error exit as soon as any error occurs. + error_format = "Failed {plugin.__name__}: {error} -- {error.traceback}" + + close_plugin = _get_close_plugin(close_plugin_name, log) + + for result in pyblish.util.publish_iter(): + for record in result["records"]: + log.info("{}: {}".format( + result["plugin"].label, record.msg)) + + if result["error"]: + log.error(error_format.format(**result)) + uninstall() + if close_plugin: # close host app explicitly after error + context = pyblish.api.Context() + close_plugin().process(context) + sys.exit(1) + + def publish_and_log(dbcon, _id, log, close_plugin_name=None): """Loops through all plugins, logs ok and fails into OP DB. From bcdca93cacbcc015d7b09babf3d23ca446b5cf8a Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 18 Nov 2021 18:17:56 +0100 Subject: [PATCH 10/15] OP-2019 - removed unwanted host --- openpype/hooks/pre_foundry_apps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hooks/pre_foundry_apps.py b/openpype/hooks/pre_foundry_apps.py index 7df1a6a833..85f68c6b60 100644 --- a/openpype/hooks/pre_foundry_apps.py +++ b/openpype/hooks/pre_foundry_apps.py @@ -13,7 +13,7 @@ class LaunchFoundryAppsWindows(PreLaunchHook): # Should be as last hook because must change launch arguments to string order = 1000 - app_groups = ["nuke", "nukex", "hiero", "nukestudio", "photoshop"] + app_groups = ["nuke", "nukex", "hiero", "nukestudio"] platforms = ["windows"] def execute(self): From 1154f61ac1a0d9382b3f9cd4304d77e2be9c65da Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 19 Nov 2021 12:26:28 +0100 Subject: [PATCH 11/15] OP-2019 - added details into documentation --- tests/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/README.md b/tests/README.md index 6317b2ab3c..d0578f8059 100644 --- a/tests/README.md +++ b/tests/README.md @@ -14,12 +14,12 @@ How to run: ---------- - single test class could be run by PyCharm and its pytest runner directly - OR -- use Openpype command 'runtests' from command line --- `${OPENPYPE_ROOT}/start.py runtests` +- use Openpype command 'runtests' from command line (`.venv` in ${OPENPYPE_ROOT} must be activated to use configured Python!) +-- `${OPENPYPE_ROOT}/python start.py runtests` By default, this command will run all tests in ${OPENPYPE_ROOT}/tests. Specific location could be provided to this command as an argument, either as absolute path, or relative path to ${OPENPYPE_ROOT}. -(eg. `${OPENPYPE_ROOT}/start.py runtests ../tests/integration`) will trigger only tests in `integration` folder. +(eg. `${OPENPYPE_ROOT}/python start.py runtests ../tests/integration`) will trigger only tests in `integration` folder. See `${OPENPYPE_ROOT}/cli.py:runtests` for other arguments. From 07fdcc6f4de08087a4f22343bb61a83cc65b0df8 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 2 Dec 2021 19:07:46 +0100 Subject: [PATCH 12/15] OP-2019 - fixed wrong value --- openpype/lib/remote_publish.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/lib/remote_publish.py b/openpype/lib/remote_publish.py index 3483898af7..b91c5f01fc 100644 --- a/openpype/lib/remote_publish.py +++ b/openpype/lib/remote_publish.py @@ -27,7 +27,7 @@ def headless_publish(log, close_plugin_name=None, is_test=False): publish_and_log(dbcon, _id, log, close_plugin_name) else: - publish(log, 'CloseAE') + publish(log, close_plugin_name) def get_webpublish_conn(): From f9a1445a748f15a6592ad06ec34b748af1fddad0 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 3 Dec 2021 10:28:41 +0100 Subject: [PATCH 13/15] OP-2019 - revert to develop version --- .../integration/hosts/photoshop/test_publish_in_photoshop.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/hosts/photoshop/test_publish_in_photoshop.py b/tests/integration/hosts/photoshop/test_publish_in_photoshop.py index b634d422f3..396468a966 100644 --- a/tests/integration/hosts/photoshop/test_publish_in_photoshop.py +++ b/tests/integration/hosts/photoshop/test_publish_in_photoshop.py @@ -25,7 +25,7 @@ class TestPublishInPhotoshop(PublishTest): ] APP = "photoshop" - APP_VARIANT = "2021" + APP_VARIANT = "2020" APP_NAME = "{}/{}".format(APP, APP_VARIANT) @@ -56,7 +56,7 @@ class TestPublishInPhotoshop(PublishTest): @pytest.fixture(scope="module") def startup_scripts(self, monkeypatch_session, download_test_data): """Points Maya to userSetup file from input data""" - pass + os.environ["IS_HEADLESS"] = "true" def test_db_asserts(self, dbcon, publish_finished): """Host and input data dependent expected results in DB.""" From 477d177bd9f9939f3c74c63ac47be5b68d52d372 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 3 Dec 2021 11:42:22 +0100 Subject: [PATCH 14/15] OP-2019 - fixes for PS test class --- .../photoshop/test_publish_in_photoshop.py | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/tests/integration/hosts/photoshop/test_publish_in_photoshop.py b/tests/integration/hosts/photoshop/test_publish_in_photoshop.py index 396468a966..4754f60486 100644 --- a/tests/integration/hosts/photoshop/test_publish_in_photoshop.py +++ b/tests/integration/hosts/photoshop/test_publish_in_photoshop.py @@ -11,7 +11,12 @@ class TestPublishInPhotoshop(PublishTest): Uses generic TestCase to prepare fixtures for test data, testing DBs, env vars. - Opens Maya, run publish on prepared workile. + Opens Photoshop, run publish on prepared workile. + + Test zip file sets 3 required env vars: + - HEADLESS_PUBLISH - this triggers publish immediately app is open + - IS_TEST - this differentiate between regular webpublish + - PYBLISH_TARGETS Then checks content of DB (if subset, version, representations were created. @@ -21,11 +26,11 @@ class TestPublishInPhotoshop(PublishTest): PERSIST = True TEST_FILES = [ - ("1Bciy2pCwMKl1UIpxuPnlX_LHMo_Xkq0K", "test_photoshop_publish.zip", "") + ("1zD2v5cBgkyOm_xIgKz3WKn8aFB_j8qC-", "test_photoshop_publish.zip", "") ] APP = "photoshop" - APP_VARIANT = "2020" + APP_VARIANT = "2021" APP_NAME = "{}/{}".format(APP, APP_VARIANT) @@ -56,12 +61,12 @@ class TestPublishInPhotoshop(PublishTest): @pytest.fixture(scope="module") def startup_scripts(self, monkeypatch_session, download_test_data): """Points Maya to userSetup file from input data""" - os.environ["IS_HEADLESS"] = "true" + pass def test_db_asserts(self, dbcon, publish_finished): """Host and input data dependent expected results in DB.""" print("test_db_asserts") - assert 5 == dbcon.count_documents({"type": "version"}), \ + assert 3 == dbcon.count_documents({"type": "version"}), \ "Not expected no of versions" assert 0 == dbcon.count_documents({"type": "version", @@ -69,25 +74,21 @@ class TestPublishInPhotoshop(PublishTest): "Only versions with 1 expected" assert 1 == dbcon.count_documents({"type": "subset", - "name": "modelMain"}), \ + "name": "imageMainBackgroundcopy"} + ), \ "modelMain subset must be present" assert 1 == dbcon.count_documents({"type": "subset", - "name": "workfileTest_task"}), \ + "name": "workfileTesttask"}), \ "workfileTest_task subset must be present" - assert 11 == dbcon.count_documents({"type": "representation"}), \ + assert 6 == dbcon.count_documents({"type": "representation"}), \ "Not expected no of representations" - assert 2 == dbcon.count_documents({"type": "representation", - "context.subset": "modelMain", - "context.ext": "abc"}), \ - "Not expected no of representations with ext 'abc'" - - assert 2 == dbcon.count_documents({"type": "representation", - "context.subset": "modelMain", - "context.ext": "ma"}), \ - "Not expected no of representations with ext 'abc'" + assert 1 == dbcon.count_documents({"type": "representation", + "context.subset": "imageMainBackgroundcopy", # noqa: E501 + "context.ext": "png"}), \ + "Not expected no of representations with ext 'png'" if __name__ == "__main__": From 2e753e1ca2aac3cc0e43e82cbe0bc31a032a1f43 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 3 Dec 2021 14:39:49 +0100 Subject: [PATCH 15/15] OP-2019 - fixes for db_asserts --- .../test_publish_in_aftereffects.py | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py b/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py index d4e88dfd4c..3d1fa8f804 100644 --- a/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py +++ b/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py @@ -13,6 +13,11 @@ class TestPublishInAfterEffects(PublishTest): Opens AfterEffects, run publish on prepared workile. + Test zip file sets 3 required env vars: + - HEADLESS_PUBLISH - this triggers publish immediately app is open + - IS_TEST - this differentiate between regular webpublish + - PYBLISH_TARGETS + Then checks content of DB (if subset, version, representations were created. Checks tmp folder if all expected files were published. @@ -21,13 +26,13 @@ class TestPublishInAfterEffects(PublishTest): PERSIST = True TEST_FILES = [ - ("1qsrq6OJWVpOeXE2LTWrdbsLqEVu155Uf", + ("1c8261CmHwyMgS-g7S4xL5epAp0jCBmhf", "test_aftereffects_publish.zip", "") ] APP = "aftereffects" - APP_VARIANT = "2021" + APP_VARIANT = "2022" APP_NAME = "{}/{}".format(APP, APP_VARIANT) @@ -63,7 +68,7 @@ class TestPublishInAfterEffects(PublishTest): def test_db_asserts(self, dbcon, publish_finished): """Host and input data dependent expected results in DB.""" print("test_db_asserts") - assert 5 == dbcon.count_documents({"type": "version"}), \ + assert 3 == dbcon.count_documents({"type": "version"}), \ "Not expected no of versions" assert 0 == dbcon.count_documents({"type": "version", @@ -71,25 +76,25 @@ class TestPublishInAfterEffects(PublishTest): "Only versions with 1 expected" assert 1 == dbcon.count_documents({"type": "subset", - "name": "modelMain"}), \ + "name": "imageMainBackgroundcopy" + }), \ "modelMain subset must be present" assert 1 == dbcon.count_documents({"type": "subset", - "name": "workfileTest_task"}), \ - "workfileTest_task subset must be present" + "name": "workfileTesttask"}), \ + "workfileTesttask subset must be present" - assert 11 == dbcon.count_documents({"type": "representation"}), \ + assert 1 == dbcon.count_documents({"type": "subset", + "name": "reviewTesttask"}), \ + "reviewTesttask subset must be present" + + assert 6 == dbcon.count_documents({"type": "representation"}), \ "Not expected no of representations" - assert 2 == dbcon.count_documents({"type": "representation", - "context.subset": "modelMain", - "context.ext": "abc"}), \ - "Not expected no of representations with ext 'abc'" - - assert 2 == dbcon.count_documents({"type": "representation", - "context.subset": "modelMain", - "context.ext": "ma"}), \ - "Not expected no of representations with ext 'abc'" + assert 1 == dbcon.count_documents({"type": "representation", + "context.subset": "imageMainBackgroundcopy", #noqa E501 + "context.ext": "png"}), \ + "Not expected no of representations with ext 'png'" if __name__ == "__main__":