py_canoe.core.configuration.Configuration

The Configuration object represents the active configuration.

Source code in src\py_canoe\core\configuration.py
39
40
41
42
43
44
45
46
47
48
49
def __init__(self, app: 'Application'):
    self.app = app
    self.bus_types = self.app.bus_types
    self.com_object = win32com.client.Dispatch(self.app.com_object.Configuration)
    # self.configuration_events: ConfigurationEvents = win32com.client.WithEvents(self.com_object, ConfigurationEvents)
    self.configuration_test_configurations = lambda: self.test_configurations
    self.configuration_test_setup = lambda: self.test_setup
    self.__test_setup_environments = self.configuration_test_setup().test_environments.fetch_all_test_environments()
    self.__test_configurations = self.configuration_test_configurations().fetch_all_test_configurations()
    self.__test_modules = list()
    self.__test_units = list()

get_compilation_result()

Get CAPL compilation result with error details.

Compiles all CAPL code in the current configuration and returns detailed result including success status and error information.

Returns:
  • dict( dict[str, object] ) –

    Dictionary with keys: - "success" (bool): True if compilation succeeded, False otherwise - "error" (str | None): Error message if compilation failed, None on success

Example

result = config.get_compilation_result() if result["success"]: ... print("Compilation OK") ... else: ... print(f"Compilation failed: {result['error']}")

Source code in src\py_canoe\core\configuration.py
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
def get_compilation_result(self) -> dict[str, object]:
    """Get CAPL compilation result with error details.

    Compiles all CAPL code in the current configuration and returns
    detailed result including success status and error information.

    Returns:
        dict: Dictionary with keys:
            - "success" (bool): True if compilation succeeded, False otherwise
            - "error" (str | None): Error message if compilation failed, None on success

    Example:
        >>> result = config.get_compilation_result()
        >>> if result["success"]:
        ...     print("Compilation OK")
        ... else:
        ...     print(f"Compilation failed: {result['error']}")
    """
    result = self._compile_and_verify_internal()
    if result["success"]:
        logger.info('CAPL compilation succeeded')
    else:
        logger.warning(f'CAPL compilation failed: {result["error"]}')
    return result

run_compilation()

Run CAPL compilation and return success status.

Compiles all CAPL code in the current configuration. Use get_compilation_result() if you need error details.

Returns:
  • bool( bool ) –

    True if compilation succeeded, False otherwise

Example

if config.run_compilation(): ... print("Compilation OK")

Source code in src\py_canoe\core\configuration.py
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
def run_compilation(self) -> bool:
    """Run CAPL compilation and return success status.

    Compiles all CAPL code in the current configuration.
    Use get_compilation_result() if you need error details.

    Returns:
        bool: True if compilation succeeded, False otherwise

    Example:
        >>> if config.run_compilation():
        ...     print("Compilation OK")
    """
    result = self._compile_and_verify_internal()
    if result["success"]:
        logger.info('CAPL compilation passed')
    else:
        logger.warning(f'CAPL compilation failed: {result["error"]}')
    return result["success"]