Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Tests: Fix failing maya automatic test #6231

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions tests/integration/hosts/maya/test_publish_in_maya.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ def test_publish(

# Check for pyblish errors.
error_regex = r"pyblish \(ERROR\)((.|\n)*?)((pyblish \())"
matches = re.findall(error_regex, logging_output)
assert not matches, matches[0][0]
allowed_errors = ["No module named \\\'pymxs\\\'"]
self._filtered_asserts(allowed_errors, error_regex, logging_output)

# Check for python errors.
error_regex = r"// Error((.|\n)*)"
matches = re.findall(error_regex, logging_output)
assert not matches, matches[0][0]
allowed_errors = []
self._filtered_asserts(allowed_errors, error_regex, logging_output)

def test_db_asserts(self, dbcon, publish_finished):
"""Host and input data dependent expected results in DB."""
Expand Down Expand Up @@ -103,6 +103,27 @@ def test_db_asserts(self, dbcon, publish_finished):

assert not any(failures)

def _filtered_asserts(self, allowed_errors, error_regex, logging_output):
matches = re.findall(error_regex, logging_output)
filtered_matches = self._filter_errors(allowed_errors, matches)
assert not filtered_matches, filtered_matches[0][0]

def _filter_errors(self, allowed_errors, matches):
"""Some errors might be actually ok.

Wrong imports caused by Pyblish logic etc.
"""
filtered_matches = []
for match in matches:
filter_out = False
for allowed_error in allowed_errors:
if allowed_error in str(match):
filter_out = True
break
if not filter_out:
filtered_matches.append(match)
return filtered_matches


if __name__ == "__main__":
test_case = TestPublishInMaya()
Loading