ayon-core/tests/integration
Petr Kalis b8ce6e9e9c
Photoshop: add autocreators for review and flat image (#4871)
* OP-5656 - added auto creator for review in PS

Review instance should be togglable.
Review instance needs to be created for non publisher based workflows.

* OP-5656 - refactored names

* OP-5656 - refactored names

* OP-5656 - new auto creator for flat image

In old version flat image was created if no instances were created. Explicit auto creator added for clarity.

Standardization of state of plugins

* OP-5656 - updated according to auto image creator

Subset template should be used from autocreator and not be separate.

* OP-5656 - fix proper creator name

* OP-5656 - fix log message

* OP-5656 - fix use enable state

* OP-5656 - fix formatting

* OP-5656 - add review toggle to image instance

For special cases where each image should have separate review.

* OP-5656 - fix description

* OP-5656 - fix not present asset and task in instance context

* OP-5656 - refactor - both auto creators should use same class

Provided separate description.

* OP-5656 - fix - propagate review to families

Image and auto image could have now review flag.
Bottom logic is only for Webpublisher.

* OP-5656 - fix - rename review files to avaid collision

Image family produces jpg and png, jpg review would clash with name. It should be replaced by 'jpg_jpg'.

* OP-5656 - fix - limit additional auto created only on WP

In artist based publishing auto image would be created by auto creator (if enabled). Artist might want to disable image creation.

* OP-5656 - added mark_for_review flag to Publish tab

* OP-5656 - fixes for auto creator

* OP-5656 - fixe - outputDef not needed

outputDef should contain dict of output definition. In PS it doesn't make sense as it has separate extract_review without output definitions.

* OP-5656 - added persistency of changes to auto creators

Changes as enabling/disabling, changing review flag should persist.

* OP-5656 - added documentation for admins

* OP-5656 - added link to new documentation for admins

* OP-5656 - Hound

* OP-5656 - Hound

* OP-5656 - fix shared families list

* OP-5656 - added default variant for review and workfile creator

For workfile Main was default variant, "" was for review.

* OP-5656 - fix - use values from Settings

* OP-5656 - fix - use original name of review for main review family

outputName cannot be in repre or file would have ..._jpg.jpg

* OP-5656 - refactor - standardized settings

Active by default denotes if created instance is active (eg. publishable) when created.

* OP-5656 - fixes for skipping collecting auto_image

data["ids"] are necessary for extracting. Members are physical layers in image, ids are "virtual" items, won't get grouped into real image instance.

* OP-5656 - reworked auto collectors

This allows to use automatic test for proper testing.

* OP-5656 - added automatic tests

* OP-5656 - fixes for auto collectors

* OP-5656 - removed unnecessary collector

Logic moved to auto collectors.

* OP-5656 - Hound
2023-05-02 11:19:50 +02:00
..
hosts Photoshop: add autocreators for review and flat image (#4871) 2023-05-02 11:19:50 +02:00
README.md Added mentioning HEADLESS_PUBLISH in readme for integration tests 2022-01-25 15:24:52 +01:00

Integration test for OpenPype

Contains end-to-end tests for automatic testing of OP.

Should run headless publish on all hosts to check basic publish use cases automatically to limit regression issues.

Uses env var HEADLESS_PUBLISH (set in test data zip files) to differentiate between regular publish and "automated" one.

How to run

  • activate {OPENPYPE_ROOT}/.venv
  • run in cmd {OPENPYPE_ROOT}/.venv/Scripts/python.exe {OPENPYPE_ROOT}/start.py runtests {OPENPYPE_ROOT}/tests/integration
    • add hosts/APP_NAME after integration part to limit only on specific app (eg. {OPENPYPE_ROOT}/tests/integration/hosts/maya)

OR can use built executables openpype_console runtests {ABS_PATH}/tests/integration

How to check logs/errors from app

Keep PERSIST to True in the class and check test_openpype.logs collection.

How to create test for publishing from host

  • Extend PublishTest in tests/lib/testing_classes.py
  • Use resources\test_data.zip skeleton file as a template for testing input data
  • Put workfile into test_data.zip/input/workfile
  • If you require other than base DB dumps provide them to test_data.zip/input/dumps -- (Check commented code in db_handler.py how to dump specific DB. Currently all collections will be dumped.)
  • Implement last_workfile_path
  • startup_scripts - must contain pointing host to startup script saved into test_data.zip/input/startup -- Script must contain something like (pseudocode)
import openpype
from avalon import api, HOST

from openpype.api import Logger

log = Logger().get_logger(__name__)
  
api.install(HOST)
log_lines = []
for result in pyblish.util.publish_iter():
    for record in result["records"]:  # for logging to test_openpype DB
        log_lines.append("{}: {}".format(
            result["plugin"].label, record.msg))

    if result["error"]:
        err_fmt = "Failed {plugin.__name__}: {error} -- {error.traceback}"
        log.error(err_fmt.format(**result))

EXIT_APP (command to exit host)

(Install and publish methods must be triggered only AFTER host app is fully initialized!)

  • If you would like add any command line arguments for your host app add it to test_data.zip/input/app_args/app_args.json (as a json list)

  • Provide any required environment variables to test_data.zip/input/env_vars/env_vars.json (as a json dictionary)

  • Zip test_data.zip, named it with descriptive name, upload it to Google Drive, right click - Get link, copy hash id (file must be accessible to anyone with a link!)

  • Put this hash id and zip file name into TEST_FILES [(HASH_ID, FILE_NAME, MD5_OPTIONAL)]. If you want to check MD5 of downloaded file, provide md5 value of zipped file.

  • Implement any assert checks you need in extended class

  • Run test class manually (via Pycharm or pytest runner (TODO))

  • If you want test to visually compare expected files to published one, set PERSIST to True, run test manually -- Locate temporary publish subfolder of temporary folder (found in debugging console log) -- Copy whole folder content into .zip file into expected subfolder -- By default tests are comparing only structure of expected and published format (eg. if you want to save space, replace published files with empty files, but with expected names!) -- Zip and upload again, change PERSIST to False

  • Use TEST_DATA_FOLDER variable in your class to reuse existing downloaded and unzipped test data (for faster creation of tests)

  • Keep APP_VARIANT empty if you want to trigger test on latest version of app, or provide explicit value (as '2022' for Photoshop for example)