ayon-core/tests
Petr Kalis e7aa413038
AfterEffects: add review flag to each instance (#4884)
* OP-5657 - add artist control for review in AfterEffects

Artist can disable review to be created for particular publish.

* OP-5657 - add artist control for review in AfterEffects

Removed configuration for Deadline, should be controlled by what is on instance.

* OP-5657 - handle legacy instances

Legacy instances wont't have mark_for_review in creator_attributes. Set to true as by default we always want review.

* OP-5657 - remove explicit review for all AE

Now handled directly on instance

* OP-5657 - fix - cannot remove now

Without this 'review' wont be added to tags on representation. Eventually this should be refactored.
Control on whole instance, eg. disabling review, should be enough.

* OP-5657 - fix - correct host name used

* OP-5657 - fix - correct handling of review

On local renders review should be added only from families, not from older approach through Settings.

Farm instance cannot have review in families or extract_review would get triggered even locally.

* OP-5657 - refactor - changed label

* OP-5657 - Hound

* OP-5657 - added explicitly skipping review

Instance might have set 'review' to False, which should explicitly skip review (might come from Publisher where artist can disable/enable review on an instance).

* OP-5657 - updated setting of review variable

instance.data.review == False >> explicitly set to do not create review. Keep None to let logic decide.

* OP-5657 - fix adding review flag

* OP-5657 - updated test

Removed review for second instance.

* OP-5657 - refactor to context plugin

* OP-5657 - tie thumbnail to review for local render

Produce thumbnail only when review should be created to synchronize state with farm rendering.
Move creation of thumnbail out of this plugin to general plugin to limit duplication of logic.
2023-05-04 12:16:58 +02:00
..
integration AfterEffects: add review flag to each instance (#4884) 2023-05-04 12:16:58 +02:00
lib Added setup_only to tests (#4591) 2023-03-13 15:37:23 +01:00
resources Merge fixes for tests from branch with Deadline tests. 2022-12-02 15:52:04 +01:00
unit adding test routine for the slate condition 2023-04-20 21:49:58 +02:00
__init__.py #1784 - added base implementation for helper DB class 2021-07-07 18:51:55 +02:00
conftest.py Added setup_only to tests (#4591) 2023-03-13 15:37:23 +01:00
README.md Merge fixes for tests from branch with Deadline tests. 2022-12-02 15:52:04 +01:00

Automatic tests for OpenPype

Requirements:

Tests are recreating fresh DB for each run, so mongorestore, mongodump and mongoimport command line tools must be installed and on Path.

You can find intallers here: https://www.mongodb.com/docs/database-tools/installation/installation/

You can test that mongorestore is available by running this in console, or cmd: mongorestore --version

Structure:

  • integration - end to end tests, slow (see README.md in the integration folder for more info)
    • openpype/modules/MODULE_NAME - structure follow directory structure in code base
      • fixture - sample data (MongoDB dumps, test files etc.)
      • tests.py - single or more pytest files for MODULE_NAME
  • unit - quick unit test
    • MODULE_NAME
      • fixture
      • tests.py

How to run:

  • use Openpype command 'runtests' from command line (.venv in ${OPENPYPE_ROOT} must be activated to use configured Python!) -- python ${OPENPYPE_ROOT}/start.py runtests

By default, this command will run all tests in ${OPENPYPE_ROOT}/tests.

Specific location could be provided to this command as an argument, either as absolute path, or relative path to ${OPENPYPE_ROOT}. (eg. python ${OPENPYPE_ROOT}/start.py start.py runtests ../tests/integration) will trigger only tests in integration folder.

See ${OPENPYPE_ROOT}/cli.py:runtests for other arguments.

Run in IDE:

If you prefer to run/debug single file directly in IDE of your choice, you might encounter issues with imports. It would manifest like KeyError: 'OPENPYPE_DATABASE_NAME'. That means you are importing module that depends on OP to be running, eg. all expected variables are set.

In some cases your tests might be so localized, that you don't care about all env vars to be set properly. In that case you might add this dummy configuration BEFORE any imports in your test file

import os
os.environ["AVALON_MONGO"] = "mongodb://localhost:27017"
os.environ["OPENPYPE_MONGO"] = "mongodb://localhost:27017"
os.environ["AVALON_DB"] = "avalon"
os.environ["OPENPYPE_DATABASE_NAME"] = "openpype"
os.environ["AVALON_TIMEOUT"] = '3000'
os.environ["OPENPYPE_DEBUG"] = "3"
os.environ["AVALON_CONFIG"] = "pype"
os.environ["AVALON_ASSET"] = "Asset"
os.environ["AVALON_PROJECT"] = "test_project"

(AVALON_ASSET and AVALON_PROJECT values should exist in your environment)

This might be enough to run your test file separately. Do not commit this skeleton though. Use only when you know what you are doing!