testplan.common.remote package

Submodules

testplan.common.remote.remote_resource module

class testplan.common.remote.remote_resource.RemoteResource(remote_host: str, ssh_port: int = 22, ssh_cmd: ~typing.Callable = <function ssh_cmd>, copy_cmd: ~typing.Callable = <function copy_cmd>, workspace: str = None, workspace_exclude: ~typing.List[str] = None, remote_runpath: str = None, testplan_path: str = None, remote_workspace: str = None, clean_remote: bool = False, push: ~typing.List[str | ~typing.Tuple] = None, push_exclude: ~typing.List[str] = None, delete_pushed: bool = False, fetch_runpath: bool = True, fetch_runpath_exclude: ~typing.List[str] = None, pull: ~typing.List[str] = None, pull_exclude: ~typing.List[str] = None, env: ~typing.Dict[str, str] = None, setup_script: ~typing.List[str] = None, status_wait_timeout: int = 60, **options)[source]

Bases: Entity

Common base class for Resource that runs on remote host. Handles logistics including copy/link workspace and testplan lib to remote, creating runpath on remote, and fetching back files from remote etc.

Parameters:
  • remote_host – Remote hostname to connect to.

  • ssh_port – The ssh port number of remote host, default is 22.

  • ssh_cmd – callable that prefix a command with ssh binary and options

  • copy_cmd – callable that returns the cmdline to do copy on remote host

  • workspace – Current project workspace to be transferred, default is pwd.

  • workspace_exclude – Patterns to exclude files when pushing workspace.

  • remote_runpath – Root runpath on remote host, default is same as local (Linux->Linux) or /var/tmp/$USER/testplan/$plan_name (Window->Linux).

  • testplan_path – Path to import testplan from on remote host, default is testplan_lib under remote_runpath

  • remote_workspace – The path of the workspace on remote host, default is fetched_workspace under remote_runpath

  • clean_remote – Deleted root runpath on remote at exit.

  • push – Files and directories to push to the remote.

  • push_exclude – Patterns to exclude files on push stage.

  • delete_pushed – Deleted pushed files on remote at exit.

  • fetch_runpath – The flag of fetch remote resource’s runpath, default to True.

  • fetch_runpath_exclude – Exclude files matching PATTERN.

  • pull – Files and directories to be pulled from the remote at the end.

  • pull_exclude – Patterns to exclude files on pull stage.

  • env – Environment variables to be propagated.

  • setup_script – Script to be executed on remote as very first thing.

  • status_wait_timeout – remote resource start/stop timeout, default is 60.

CONFIG

alias of RemoteResourceConfig

property error_exec: list
class testplan.common.remote.remote_resource.RemoteResourceConfig(**options)[source]

Bases: UnboundRemoteResourceConfig

classmethod get_options()[source]

Schema for options validation and assignment of default values.

class testplan.common.remote.remote_resource.UnboundRemoteResourceConfig(**options)[source]

Bases: EntityConfig

classmethod get_options()[source]

Schema for options validation and assignment of default values.

class testplan.common.remote.remote_resource.WorkerSetupMetadata[source]

Bases: object

Metadata used on worker setup stage execution. Pushed dirs and files will be registered for deletion at exit.

testplan.common.remote.remote_service module

Module implementing RemoteService class. Based on RPyC package.

class testplan.common.remote.remote_service.RemoteService(name: str, remote_host: str, rpyc_bin: str = '/home/docs/checkouts/readthedocs.org/user_builds/testplan/envs/latest/lib/python3.13/site-packages/rpyc/../../bin/rpyc_classic.py', rpyc_port: str = 0, stop_timeout: float = 5, **options)[source]

Bases: Resource, RemoteResource

Spawns RPyC service on remote host via ssh and create RPyC connection for remote drivers.

Parameters:
  • name – Name of the remote service.

  • remote_host – Remote host name or IP address.

  • rpyc_bin – Location of rpyc_classic.py script

  • rpyc_port – Specific port for rpyc connection on the remote host. Defaults to 0 which start the rpyc server on a random port.

  • stop_timeout – Timeout of graceful shutdown (in seconds).

Also inherits all Resource and RemoteResource options

CONFIG

alias of RemoteServiceConfig

post_start() None[source]

After service is started.

post_stop() None[source]

After stopping the service.

pre_start() None[source]

Before service start.

pre_stop() None[source]

Before stopping the service.

starting() None[source]

Starting the rpyc service on remote host.

stopping() None[source]

Stops remote rpyc process.

uid() str[source]

Unique identifier.

class testplan.common.remote.remote_service.RemoteServiceConfig(**options)[source]

Bases: ResourceConfig, RemoteResourceConfig

Configuration object for RemoteService entity.

classmethod get_options()[source]

Resource specific config options.

testplan.common.remote.remote_driver module

class testplan.common.remote.remote_driver.RemoteDriver(remote_service, driver_cls, **options)[source]

Bases: object

A proxy object that forwards access of itself to the actual driver that runs on remote host via the remote_service’s rpyc connection. :param remote_service: the remote_service object to use :type remote_service: RemoteService :param driver_class: the class of the driver to instantiate on remote host :type driver_class: class

Also takes all driver_class’s options.

uid() str[source]

Module contents