ecutest.lifecycle¶
-
class ecutest.lifecycle.EcuTestController(executable: str | PathLike | None =
None, xmlrpc_port: int | None =None, restapi_port: int =5050, silent: bool =False, **kwargs: object)¶ A controller for managing the lifecycle of an ecu.test runner instance to be used by ecu.test code.
- Parameters:
- executable: str | PathLike | None =
None¶ The path to the ecu.test runner executable. If
None, the constructor will try to find a suitable ecu.test runner executable.- xmlrpc_port: int | None =
None¶ The xmlrpc port to use. If the executable is auto-detected, this will also be auto-detected. If the executable is specified explicitly and you are using a non-default port, you must specify it here. Otherwise, the default port 8000 will be used.
- restapi_port: int =
5050¶ The REST API port to use.
- silent: bool =
False¶ suppress all output from called external commands.
- executable: str | PathLike | None =
-
start(workspace: str | PathLike | None =
None, tbc: str | PathLike | None =None, tcf: str | PathLike | None =None, extra_args: list[str] | None =None, allow_restart: bool =False, accept_any_version: bool =False)¶ Start ecu.test runner in the specified workspace, load the specified testbench configuration (TBC) and test configuration (TCF), and start the web API.
If an appropriate ecu.test instance is already running in the correct workspace, the running instance will be used.
- Parameters:
- workspace: str | PathLike | None =
None¶ The workspace directory to use. If
None, no workspace will be specified on the command line, causing ecu.test runner to start in the most recently used workspace.- tbc: str | PathLike | None =
None¶ The testbench configuration file to load. If
None, no TBC will be explicitly loaded, so the one that happens to be loaded or to have been loaded in the most recent session in this workspace will be used.- tcf: str | PathLike | None =
None¶ The test configuration file to load. If
None, no TCF will be explicitly loaded, so the one that happens to be loaded or to have been loaded in the most recent session in this workspace will be used.- extra_args: list[str] | None =
None¶ Additional command line arguments to pass to the ecu.test runner. Note that these won’t be taken into account when deciding whether a restart is needed.
- allow_restart: bool =
False¶ Determines whether an already running instance of ecu.test may be restarted if the workspace or the version/executable doesn’t match.
- accept_any_version: bool =
False¶ If
True, a running instance will be used regardless of its version or excecutable, provided it is running in the correct workspace. In case of a restart as well as for any later start, that instance’s runner executable will be used instead of the one specified in the constructor call or automatically determined by the constructor.
- workspace: str | PathLike | None =
-
stop(timeout: int =
90)¶ Ask the ecu.test runner instance to quit gracefully.
- Parameters:
- timeout: int =
90¶ The maximum time to wait for the ecu.test instance to stop before an exception is raised.
- timeout: int =
This also acts on instances not started by this lifecycle controller.
-
running_ecutest(workspace: str | PathLike | None =
None, tbc: str | PathLike | None =None, tcf: str | PathLike | None =None, extra_args: list[str] | None =None, allow_restart: bool =False, accept_any_version: bool =False, stop_on_exit: bool | None =None)¶ Context manager to ensure that an ecu.test instance is running in the specified workspace with the specified TBC and TCF.
- Parameters:
- stop_on_exit: bool | None =
None¶ If
True, the ecu.test instance will be stopped when the context manager exits.If
False, the ecu.test instance will be left running.If
None, the instance will be stopped if it was started (or restarted) by this context manager, but left running if an already running instance was used.
- stop_on_exit: bool | None =
- See:
start()for the other parameters.
- start_webapi()¶
Start the ecu.test web API in an already running ecu.test instance.
If ecu.test is not running, use the
start()method instead.
- is_webapi_active() bool¶
Check if the ecu.test web API is active. This returns
Falseif either ecu.test is not running or the web API is not active.
- get_running_ecutest_version() str | None¶
Get the version of the currently running ecu.test instance. If ecu.test is not running, this returns
None.
- is_runner() bool | None¶
Check if the currently running ecu.test instance is the runner variant.
This returns
Truefor ecu.test runner,Falsefor the ecu.test GUI variant, andNoneif ecu.test is not running.
- get_running_ecutest_install_dir() str | None¶
Get the install directory of the currently running ecu.test instance. If ecu.test is not running, this returns
None.
- get_current_workspace() str | None¶
Determine the workspace the currently running ecu.test instance is using. If ecu.test is not running, this returns
None.
- get_loaded_tbc() str | None¶
Determine the testbench configuration (TBC) the currently running ecu.test instance is using. Note that the configuration might be selected but not started, cf.
is_config_started(). If ecu.test is not running, this returnsNone.
- get_loaded_tcf() str | None¶
Determine the test configuration (TCF) the currently running ecu.test instance is using. Note that the configuration might be selected but not started, cf.
is_config_started(). If ecu.test is not running, this returnsNone.
- is_config_started() bool¶
Check whether in the running ecu.test instance, the configuration is started. If ecu.test is not running, this returns
False.