DemoProcessManager

DemoProcessManager simulates Odoo command execution for tests and demos.

class oduit.demo_process_manager.DemoProcessManager(available_modules: list[str] | None = None)[source]

Bases: BaseProcessManager

Mock process manager for demo mode that simulates Odoo operations

__init__(available_modules: list[str] | None = None)[source]

Initialize with list of available modules

run_command(cmd: list[str], stop_on_error: bool = False, compact: bool = False, verbose: bool = False, suppress_output: bool = False) dict[str, Any][source]

Execute a command in demo mode with simulated behavior

run_command_yielding(cmd: list[str], stop_on_error: bool = False, compact: bool = False, verbose: bool = False, suppress_output: bool = False) Generator[dict[str, Any], None, None][source]

Generator version that yields lines as they arrive for demo operations

run_operation(command_operation: CommandOperation, verbose: bool = False, suppress_output: bool = False) dict[str, Any][source]

Execute a CommandOperation directly in demo mode.

This provides enhanced result processing with parsing for demo operations.

Parameters:
  • command_operation – Structured command operation with metadata

  • verbose – Enable verbose output

  • suppress_output – Suppress output to console

Returns:

Dict containing execution results

run_shell_command(cmd: list[str] | str, verbose: bool = False, capture_output: bool = True, allow_shell: bool = False, input_data: str | None = None) dict[str, Any][source]

Simulate shell command execution

static run_interactive_shell(cmd: list[str]) int[source]

Simulate interactive shell - just print a message

Usage Examples

from oduit import DemoProcessManager
from oduit.builders import InstallCommandBuilder

config = {
    "python_bin": "python3",
    "odoo_bin": "odoo-bin",
    "db_name": "demo_db",
    "addons_path": "./addons",
    "demo_mode": True,
}

manager = DemoProcessManager(available_modules=["base", "sale", "purchase"])
operation = InstallCommandBuilder(config, "sale").build_operation()
result = manager.run_operation(operation)

assert result["success"]

Notes

  • This is intended for simulated execution and test scenarios

  • It is public, but separate from the supported runtime manager types exposed to users through normal process-manager selection