OP-3426 - added filtering of published folders from comparing

Some files or folders are dynamically created and cannot be part of comparing of published and expected folder structure.
(Example is Logs in AE from DL)
This commit is contained in:
Petr Kalis 2022-10-24 11:52:08 +02:00
parent f703e53651
commit d35ea96bd0
5 changed files with 35 additions and 4 deletions

View file

@ -37,6 +37,11 @@ class AEHostFixtures(HostFixtures):
"""Points Maya to userSetup file from input data"""
pass
@pytest.fixture(scope="module")
def skip_compare_folders(self):
# skip folder that contain "Logs", these come only from Deadline
return ["Logs"]
class AELocalPublishTestClass(AEHostFixtures, PublishTest):
"""Testing class for local publishes."""

View file

@ -44,6 +44,10 @@ class MayaHostFixtures(HostFixtures):
os.pathsep,
original_pythonpath))
@pytest.fixture(scope="module")
def skip_compare_folders(self):
yield []
class MayaLocalPublishTestClass(MayaHostFixtures, PublishTest):
"""Testing class for local publishes."""

View file

@ -56,6 +56,9 @@ class NukeHostFixtures(HostFixtures):
os.pathsep,
original_nuke_path))
@pytest.fixture(scope="module")
def skip_compare_folders(self):
yield []
class NukeLocalPublishTestClass(NukeHostFixtures, PublishTest):
"""Testing class for local publishes."""

View file

@ -32,3 +32,7 @@ class PhotoshopTestClass(HostFixtures):
def startup_scripts(self, monkeypatch_session, download_test_data):
"""Points Maya to userSetup file from input data"""
pass
@pytest.fixture(scope="module")
def skip_compare_folders(self):
yield []

View file

@ -9,6 +9,7 @@ import shutil
import glob
import platform
import requests
import re
from tests.lib.db_handler import DBHandler
from common.openpype_common.distribution.file_handler import RemoteFileHandler
@ -316,7 +317,8 @@ class PublishTest(ModuleUnitTest):
yield True
def test_folder_structure_same(self, dbcon, publish_finished,
download_test_data, output_folder_url):
download_test_data, output_folder_url,
skip_compare_folders):
"""Check if expected and published subfolders contain same files.
Compares only presence, not size nor content!
@ -334,9 +336,17 @@ class PublishTest(ModuleUnitTest):
glob.glob(expected_dir_base + "\\**", recursive=True)
if f != expected_dir_base and os.path.exists(f))
not_matched = expected.symmetric_difference(published)
assert not not_matched, "Missing {} files".format(
"\n".join(sorted(not_matched)))
filtered_published = set()
for pub_path in published:
for val in skip_compare_folders:
if not re.search(val, pub_path):
filtered_published.add(pub_path)
not_matched = expected.symmetric_difference(filtered_published)
if not_matched:
self.failed = True
raise AssertionError("Missing {} files".format(
"\n".join(sorted(not_matched))))
class DeadlinePublishTest(PublishTest):
@ -419,3 +429,8 @@ class HostFixtures():
def startup_scripts(self, monkeypatch_session, download_test_data):
""""Adds init scripts (like userSetup) to expected location"""
raise NotImplementedError
@pytest.fixture(scope="module")
def skip_compare_folders(self):
"""Use list of regexs to filter out published folders from comparing"""
raise NotImplementedError