OP-3426 - DL support for Maya automatic tests

WIP
This commit is contained in:
Petr Kalis 2022-10-14 15:21:25 +02:00
parent 8bf63ef3e7
commit e3864ead41
4 changed files with 139 additions and 5 deletions

View file

@ -2,10 +2,14 @@ import os
import pytest
import shutil
from tests.lib.testing_classes import HostFixtures
from tests.lib.testing_classes import (
HostFixtures,
PublishTest,
DeadlinePublishTest
)
class MayaTestClass(HostFixtures):
class MayaHostFixtures(HostFixtures):
@pytest.fixture(scope="module")
def last_workfile_path(self, download_test_data, output_folder_url):
"""Get last_workfile_path from source data.
@ -39,3 +43,11 @@ class MayaTestClass(HostFixtures):
"{}{}{}".format(startup_path,
os.pathsep,
original_pythonpath))
class MayaLocalPublishTestClass(MayaHostFixtures, PublishTest):
"""Testing class for local publishes."""
class MayaDeadlinePublishTestClass(MayaHostFixtures, DeadlinePublishTest):
"""Testing class for Deadline publishes."""

View file

@ -0,0 +1,70 @@
from tests.integration.hosts.maya.lib import MayaDeadlinePublishTestClass
class TestDeadlinePublishInMaya(MayaDeadlinePublishTestClass):
"""Basic test case for publishing in Maya
Shouldnt be running standalone only via 'runtests' pype command! (??)
Uses generic TestCase to prepare fixtures for test data, testing DBs,
env vars.
Always pulls and uses test data from GDrive!
Opens Maya, runs publish on prepared workile.
Then checks content of DB (if subset, version, representations were
created.
Checks tmp folder if all expected files were published.
How to run:
(in cmd with activated {OPENPYPE_ROOT}/.venv)
{OPENPYPE_ROOT}/.venv/Scripts/python.exe {OPENPYPE_ROOT}/start.py runtests ../tests/integration/hosts/maya # noqa: E501
"""
PERSIST = True
TEST_FILES = [
("1BTSIIULJTuDc8VvXseuiJV_fL6-Bu7FP", "test_maya_publish.zip", "")
]
APP = "maya"
# keep empty to locate latest installed variant or explicit
APP_VARIANT = ""
TIMEOUT = 120 # publish timeout
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 = TestDeadlinePublishInMaya()

View file

@ -1,7 +1,7 @@
from tests.integration.hosts.maya.lib import MayaTestClass
from tests.integration.hosts.maya.lib import MayaLocalPublishTestClass
class TestPublishInMaya(MayaTestClass):
class TestPublishInMaya(MayaLocalPublishTestClass):
"""Basic test case for publishing in Maya
Shouldnt be running standalone only via 'runtests' pype command! (??)