OP-3684 - fix output compare for automatic testing

This commit is contained in:
Petr Kalis 2022-08-03 13:34:24 +02:00
parent 80b6ef981a
commit 0761ba4bc3

View file

@ -314,30 +314,21 @@ class PublishTest(ModuleUnitTest):
Compares only presence, not size nor content! Compares only presence, not size nor content!
""" """
published_dir_base = download_test_data published_dir_base = output_folder_url
published_dir = os.path.join(output_folder_url, expected_dir_base = os.path.join(download_test_data,
self.PROJECT,
self.ASSET,
self.TASK,
"**")
expected_dir_base = os.path.join(published_dir_base,
"expected") "expected")
expected_dir = os.path.join(expected_dir_base,
self.PROJECT, print("Comparing published:'{}' : expected:'{}'".format(published_dir_base,
self.ASSET, expected_dir_base))
self.TASK,
"**")
print("Comparing published:'{}' : expected:'{}'".format(published_dir,
expected_dir))
published = set(f.replace(published_dir_base, '') for f in published = set(f.replace(published_dir_base, '') for f in
glob.glob(published_dir, recursive=True) if glob.glob(published_dir_base + "\\**", recursive=True) if
f != published_dir_base and os.path.exists(f)) f != published_dir_base and os.path.exists(f))
expected = set(f.replace(expected_dir_base, '') for f in expected = set(f.replace(expected_dir_base, '') for f in
glob.glob(expected_dir, recursive=True) if glob.glob(expected_dir_base + "\\**", recursive=True) if
f != expected_dir_base and os.path.exists(f)) f != expected_dir_base and os.path.exists(f))
not_matched = expected.difference(published) not_matched = expected.symmetric_difference(published)
assert not not_matched, "Missing {} files".format(not_matched) assert not not_matched, "Missing {} files".format("\n".join(sorted(not_matched)))
class HostFixtures(PublishTest): class HostFixtures(PublishTest):