nuketesting.runner.cli

Script to parse CLI args and invoke the test runner.

Attributes

Exceptions

CLICommandError

Exception to raise when provided commands are invalid.

Classes

CLIRunArguments

Object to store all passed arguments into a single dataclass and run.

Functions

main(→ NoReturn)

Nuke Test Runner CLI Interface.

Module Contents

exception CLICommandError

Bases: Exception

Exception to raise when provided commands are invalid.

class CLIRunArguments

Object to store all passed arguments into a single dataclass and run.

__post_init__() None

Post initialize checks for the arguments.

config: pathlib.Path | None = None

Config JSON to override everything and have a predefined test run.

nuke_executable: pathlib.Path | None = None

Path to Nuke executable.

pytest_args: tuple[str] = ()

Additional arguments to forward to pytest.

run_in_terminal_mode: bool = True

Run tests in Nuke using the native terminal mode or using the current Python interpreter.

runner_name: str | None = None

Optional name of a runner to run. This will only run the runner with the name.

test_directory: pathlib.Path

Directory specified by user to test. Defaults to current directory.

NO_CONFIG_FOUND_ERROR
RUNNER_AND_EXE_PROVIDED_ERROR
RUNNER_OR_EXE_MISSING_ERROR
main(
nuke_executable: click.Path,
test_path: click.Path,
config: click.Path,
terminal: bool,
pytest_arg: list,
runner_name: str,
) NoReturn

Nuke Test Runner CLI Interface.

This bootstraps Nuke within the test runner to be able to run pytest like usual, with all Nuke dependencies.

The test-path is the folder or file of the tests you want to execute. Use the pytest folder/file.py::class::method notation to run single tests. For further options consult the pytest documentation.

If you don’t specify the test-path it will use the current directory like pytest does.

Use the nuke-executable argument to specify the location of your nuke executable.

If you like to store the nuke-executable and some additional configuration, you can create a runners.json file and reference created runners with the runner-name argument:

NukeTestrunner –config runners.json –runner-name nuke15 –test-path /tests

If a “runners.json” is saved within the folder tree of the test path, it will be automatically loaded. Then you can use a shorter command:

NukeTestrunner –runner-name nuke15 –test-path /tests