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

Testing: Ingest expected files and input workfile #5840

Merged

Conversation

tokejepsen
Copy link
Member

@tokejepsen tokejepsen commented Oct 31, 2023

Changelog Description

This ingests the Maya workfile from the Drive storage. Have changed the format to MayaAscii so its easier to see what changes are happening in a PR. This meant changing the expected files and database entries as well.

Testing notes:

.\openpype_console.bat runtests C:\Users\tokejepsen\OpenPype\tests\integration\hosts\maya\test_publish_in_maya.py --mongo_url "mongodb://localhost:2707/"

Split from #5644

@tokejepsen tokejepsen added the sponsored Client endorsed or requested label Oct 31, 2023
@ynbot ynbot added type: enhancement Enhancements to existing functionality host: Maya size/XL Denotes a PR changes 1500-2499 lines, ignoring general files labels Oct 31, 2023
Implemented LocalFileHandler.
Test name added to structure to separate files for each test.
Removed superfluous `files` to keep other Maya test working
@kalisp
Copy link
Member

kalisp commented Nov 8, 2023

Implemented LocalFileHandler to load from folder in repo. (And to match all other folder comparison.)
Test name added to structure to separate files for each test.
AnyDesk_Y8HKgi065P

Removed superfluous files to keep other Maya test working

@tokejepsen
Copy link
Member Author

@kalisp nice solution!

I've fixed some issues and added a suggestion to skip directories when checking the folder structure, otherwise I get this error when testing Maya:

___________________________ TestPublishInMaya.test_folder_structure_same ____________________________

self = <test_publish_in_maya.TestPublishInMaya object at 0x000002E6D52E2760>
dbcon = <openpype.pipeline.mongodb.AvalonMongoDB object at 0x000002E6D50BBF40>
publish_finished = True, download_test_data = 'C:\\Users\\TOKEJE~1\\AppData\\Local\\Temp\\tmpc71s9xn6'
output_folder_url = 'C:\\Users\\TOKEJE~1\\AppData\\Local\\Temp\\tmpc71s9xn6\\output'
skip_compare_folders = [], setup_only = None

    def test_folder_structure_same(self, dbcon, publish_finished,
                                   download_test_data, output_folder_url,
                                   skip_compare_folders,
                                   setup_only):
        """Check if expected and published subfolders contain same files.

            Compares only presence, not size nor content!
        """
        if setup_only or self.SETUP_ONLY:
            print("Creating only setup for test, not launching app")
            return

        published_dir_base = output_folder_url
        expected_dir_base = os.path.join(download_test_data,
                                         "expected")

        print(
            "Comparing published:'{}' : expected:'{}'".format(
                published_dir_base, expected_dir_base
            )
        )

        def get_files(dir_base):
            result = set()

            for f in glob.glob(dir_base + "\\**", recursive=True):
                #if os.path.isdir(f):
                #    continue

                if f != dir_base and os.path.exists(f):
                    result.add(f.replace(dir_base, ""))

            return result

        published = get_files(published_dir_base)
        expected = get_files(expected_dir_base)

        filtered_published = self._filter_files(
            published, skip_compare_folders
        )

        # filter out temp files also in expected
        # could be polluted by accident by copying 'output' to zip file
        filtered_expected = self._filter_files(expected, skip_compare_folders)

        not_matched = filtered_expected.symmetric_difference(
            filtered_published
        )
        if not_matched:
>           raise AssertionError(
                "Missing {} files".format("\n".join(sorted(not_matched)))
            )
E           AssertionError: Missing \test_project\test_asset\work\test_task\cache
E           \test_project\test_asset\work\test_task\cache\alembic files

..\tests\lib\testing_classes.py:413: AssertionError

We could maybe look at preventing Maya from creating the empty folder in the first place, but I dont think that is worth the effort. And is there any point in testing for empty folders?

@kalisp
Copy link
Member

kalisp commented Nov 9, 2023

I think there is no need to test empty folders, just wondering why it haven't happened for me.

(Oh, I know, thats probably git, it will not create empty folders but I copied them.)

@tokejepsen tokejepsen changed the title Testing: Ingest Maya Input Workfile Testing: Ingest expected files and input workfile Nov 9, 2023
tests/lib/testing_classes.py Outdated Show resolved Hide resolved
tests/lib/testing_classes.py Outdated Show resolved Hide resolved
@kalisp kalisp assigned antirotor and unassigned kalisp Nov 9, 2023
@ynbot ynbot added the module: Deadline AWS Deadline related features label Nov 9, 2023
@kalisp
Copy link
Member

kalisp commented Nov 9, 2023

Does this still depend on #5785 ? I think that one should be closed and only this PR used.

@tokejepsen
Copy link
Member Author

Does this still depend on #5785 ? I think that one should be closed and only this PR used.

No its does not depend on #5785 anymore. Will close that PR when this gets merged.

@kalisp kalisp merged commit 9607db5 into ynput:develop Nov 9, 2023
26 checks passed
@ynbot ynbot added this to the next-patch milestone Nov 9, 2023
@tokejepsen tokejepsen deleted the enhancement/testing_maya_input_workfile branch November 9, 2023 16:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
host: Maya module: Deadline AWS Deadline related features size/XL Denotes a PR changes 1500-2499 lines, ignoring general files sponsored Client endorsed or requested type: enhancement Enhancements to existing functionality
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants