Merge branch 'develop' into enhancement/OP-4770_Global-colorspace-parse_colorspace_from_filepath-simplification

This commit is contained in:
Jakub Jezek 2023-09-21 16:58:11 +02:00
commit c166b5898a
No known key found for this signature in database
GPG key ID: 730D7C02726179A7
469 changed files with 29571 additions and 4863 deletions

View file

@ -19,7 +19,7 @@ import logging
from pyblish.api import Instance as PyblishInstance
from tests.lib.testing_classes import BaseTest
from openpype.plugins.publish.validate_sequence_frames import (
from openpype.hosts.unreal.plugins.publish.validate_sequence_frames import (
ValidateSequenceFrames
)
@ -38,7 +38,13 @@ class TestValidateSequenceFrames(BaseTest):
data = {
"frameStart": 1001,
"frameEnd": 1002,
"representations": []
"representations": [],
"assetEntity": {
"data": {
"clipIn": 1001,
"clipOut": 1002,
}
}
}
yield Instance
@ -58,6 +64,7 @@ class TestValidateSequenceFrames(BaseTest):
]
instance.data["representations"] = representations
instance.data["frameEnd"] = 1001
instance.data["assetEntity"]["data"]["clipOut"] = 1001
plugin.process(instance)
@ -84,49 +91,11 @@ class TestValidateSequenceFrames(BaseTest):
plugin.process(instance)
@pytest.mark.parametrize("files",
[["Main_beauty.1001.v001.exr",
"Main_beauty.1002.v001.exr"]])
def test_validate_sequence_frames_wrong_name(self, instance,
plugin, files):
# tests for names with number inside, caused clique failure before
representations = [
{
"ext": "exr",
"files": files,
}
]
instance.data["representations"] = representations
with pytest.raises(AssertionError) as excinfo:
plugin.process(instance)
assert ("Must detect single collection" in
str(excinfo.value))
@pytest.mark.parametrize("files",
[["Main_beauty.v001.1001.ass.gz",
"Main_beauty.v001.1002.ass.gz"]])
def test_validate_sequence_frames_possible_wrong_name(
self, instance, plugin, files):
# currently pattern fails on extensions with dots
representations = [
{
"files": files,
}
]
instance.data["representations"] = representations
with pytest.raises(AssertionError) as excinfo:
plugin.process(instance)
assert ("Must not have remainder" in
str(excinfo.value))
@pytest.mark.parametrize("files",
[["Main_beauty.v001.1001.ass.gz",
"Main_beauty.v001.1002.ass.gz"]])
def test_validate_sequence_frames__correct_ext(
self, instance, plugin, files):
# currently pattern fails on extensions with dots
representations = [
{
"ext": "ass.gz",
@ -147,6 +116,7 @@ class TestValidateSequenceFrames(BaseTest):
]
instance.data["representations"] = representations
instance.data["frameEnd"] = 1003
instance.data["assetEntity"]["data"]["clipOut"] = 1003
plugin.process(instance)
@ -160,6 +130,7 @@ class TestValidateSequenceFrames(BaseTest):
]
instance.data["representations"] = representations
instance.data["frameEnd"] = 1003
instance.data["assetEntity"]["data"]["clipOut"] = 1003
with pytest.raises(ValueError) as excinfo:
plugin.process(instance)
@ -175,6 +146,7 @@ class TestValidateSequenceFrames(BaseTest):
]
instance.data["representations"] = representations
instance.data["frameEnd"] = 1003
instance.data["assetEntity"]["data"]["clipOut"] = 1003
with pytest.raises(AssertionError) as excinfo:
plugin.process(instance)
@ -195,6 +167,7 @@ class TestValidateSequenceFrames(BaseTest):
instance.data["slate"] = True
instance.data["representations"] = representations
instance.data["frameEnd"] = 1003
instance.data["assetEntity"]["data"]["clipOut"] = 1003
plugin.process(instance)

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""Test suite for delivery functions."""
from openpype.lib.delivery import collect_frames
from openpype.lib import collect_frames
def test_collect_frames_multi_sequence():
@ -153,4 +153,3 @@ def test_collect_frames_single_file():
print(ret)
assert ret == expected, "Not matching"

View file

@ -0,0 +1,83 @@
from openpype.lib.events import EventSystem, QueuedEventSystem
def test_default_event_system():
output = []
expected_output = [3, 2, 1]
event_system = EventSystem()
def callback_1():
event_system.emit("topic.2", {}, None)
output.append(1)
def callback_2():
event_system.emit("topic.3", {}, None)
output.append(2)
def callback_3():
output.append(3)
event_system.add_callback("topic.1", callback_1)
event_system.add_callback("topic.2", callback_2)
event_system.add_callback("topic.3", callback_3)
event_system.emit("topic.1", {}, None)
assert output == expected_output, (
"Callbacks were not called in correct order")
def test_base_event_system_queue():
output = []
expected_output = [1, 2, 3]
event_system = QueuedEventSystem()
def callback_1():
event_system.emit("topic.2", {}, None)
output.append(1)
def callback_2():
event_system.emit("topic.3", {}, None)
output.append(2)
def callback_3():
output.append(3)
event_system.add_callback("topic.1", callback_1)
event_system.add_callback("topic.2", callback_2)
event_system.add_callback("topic.3", callback_3)
event_system.emit("topic.1", {}, None)
assert output == expected_output, (
"Callbacks were not called in correct order")
def test_manual_event_system_queue():
output = []
expected_output = [1, 2, 3]
event_system = QueuedEventSystem(auto_execute=False)
def callback_1():
event_system.emit("topic.2", {}, None)
output.append(1)
def callback_2():
event_system.emit("topic.3", {}, None)
output.append(2)
def callback_3():
output.append(3)
event_system.add_callback("topic.1", callback_1)
event_system.add_callback("topic.2", callback_2)
event_system.add_callback("topic.3", callback_3)
event_system.emit("topic.1", {}, None)
while True:
if event_system.process_next_event() is None:
break
assert output == expected_output, (
"Callbacks were not called in correct order")

View file

@ -12,16 +12,19 @@
removes temporary databases (?)
"""
import pytest
from bson.objectid import ObjectId
from tests.lib.testing_classes import ModuleUnitTest
from bson.objectid import ObjectId
from openpype.modules.sync_server.utils import SiteAlreadyPresentError
class TestSiteOperation(ModuleUnitTest):
REPRESENTATION_ID = "60e578d0c987036c6a7b741d"
TEST_FILES = [("1eCwPljuJeOI8A3aisfOIBKKjcmIycTEt",
TEST_FILES = [("1FHE70Hi7y05LLT_1O3Y6jGxwZGXKV9zX",
"test_site_operations.zip", '')]
@pytest.fixture(scope="module")
@ -71,7 +74,7 @@ class TestSiteOperation(ModuleUnitTest):
@pytest.mark.usefixtures("setup_sync_server_module")
def test_add_site_again(self, dbcon, setup_sync_server_module):
"""Depends on test_add_site, must throw exception."""
with pytest.raises(ValueError):
with pytest.raises(SiteAlreadyPresentError):
setup_sync_server_module.add_site(self.TEST_PROJECT_NAME,
self.REPRESENTATION_ID,
site_name='test_site')