This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
Testing: adding support for synthetic workfile in nuke integration tests #5278
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
aa8e6b4
nuke testing updates
jakubjezek001 ef65643
nuke synth workfile create test wip
jakubjezek001 b2fa8c2
adding host running fixture with waiting
jakubjezek001 2964b5e
fixing confusing operation of start_last_workfile
jakubjezek001 9b06117
syntetic testing in nuke wip
jakubjezek001 d8aa560
Merge branch 'develop' into tests/nuke-workfile-synthetic
jakubjezek001 8b973f7
Merge branch 'develop' into tests/nuke-workfile-synthetic
jakubjezek001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import os | ||
import nuke | ||
from openpype.pipeline import registered_host | ||
from openpype.lib import Logger | ||
from openpype.hosts.nuke.api.lib import WorkfileSettings | ||
|
||
log = Logger().get_logger(__name__) | ||
|
||
|
||
def script_create(): | ||
log.info("_______ Callback started _______") | ||
|
||
last_workfile_path = os.getenv("AVALON_LAST_WORKFILE") | ||
log.info("Nuke script created: {}".format(last_workfile_path)) | ||
|
||
host = registered_host() | ||
|
||
# set workfile properties | ||
workfile_settings = WorkfileSettings() | ||
workfile_settings.set_context_settings() | ||
|
||
|
||
# save workfile | ||
host.save_file(last_workfile_path) | ||
|
||
|
||
def close_script(): | ||
log.info("_______ Closing script _______") | ||
nuke.scriptExit() | ||
|
||
|
||
nuke.addOnUserCreate(script_create, nodeClass="Root") | ||
nuke.removeOnCreate(script_create, nodeClass="Root") | ||
nuke.addOnScriptSave(close_script) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import os | ||
import logging | ||
from tests.integration.hosts.nuke.lib import NukeLocalSyntheticTestClass | ||
|
||
log = logging.getLogger("test_workfile_create") | ||
|
||
|
||
class TestWorkfileCreate(NukeLocalSyntheticTestClass): | ||
"""Basic test case for publishing in Nuke | ||
|
||
Uses generic TestCase to prepare fixtures for test data, testing DBs, | ||
env vars. | ||
|
||
!!! | ||
It expects modified path in WriteNode, | ||
use '[python {nuke.script_directory()}]' instead of regular root | ||
dir (eg. instead of `c:/projects`). | ||
Access file path by selecting WriteNode group, CTRL+Enter, update file | ||
input | ||
!!! | ||
|
||
Opens Nuke, run publish on prepared workile. | ||
|
||
Then checks content of DB (if subset, version, representations were | ||
created. | ||
Checks tmp folder if all expected files were published. | ||
|
||
How to run: | ||
(in cmd with activated {OPENPYPE_ROOT}/.venv) | ||
{OPENPYPE_ROOT}/.venv/Scripts/python.exe {OPENPYPE_ROOT}/start.py | ||
runtests ../tests/integration/hosts/nuke # noqa: E501 | ||
|
||
To check log/errors from launched app's publish process keep PERSIST | ||
to True and check `test_openpype.logs` collection. | ||
""" | ||
# https://drive.google.com/file/d/1SUurHj2aiQ21ZIMJfGVBI2KjR8kIjBGI/view?usp=sharing # noqa: E501 | ||
TEST_FILES = [ | ||
("1SUurHj2aiQ21ZIMJfGVBI2KjR8kIjBGI", "test_Nuke_publish.zip", "") | ||
] | ||
|
||
APP_GROUP = "nuke" | ||
|
||
TIMEOUT = 50 # publish timeout | ||
|
||
# could be overwritten by command line arguments | ||
# keep empty to locate latest installed variant or explicit | ||
APP_VARIANT = "" | ||
PERSIST = True # True - keep test_db, test_openpype, outputted test files | ||
TEST_DATA_FOLDER = r"C:\CODE\__PYPE\__unit_testing_data\test_nuke_workfile" | ||
|
||
def test_workfile_created( | ||
self, last_workfile_path, | ||
disable_workfile_tool_start, | ||
testing_in_host_finished | ||
): | ||
"""Testing whether workfile was created with hosts workio.""" | ||
print("test_workfile_created") | ||
|
||
expected_dir, _ = os.path.split(last_workfile_path) | ||
|
||
# check if workfile directory was created | ||
assert os.path.exists(expected_dir) | ||
|
||
# check if workfile was created | ||
assert os.path.exists(last_workfile_path) | ||
|
||
# check if workfile is not empty | ||
assert os.path.getsize(last_workfile_path) > 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
test_case = TestWorkfileCreate() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many blank lines (2)