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: Callable = <function ssh_cmd>, copy_cmd: Callable = <function copy_cmd>, workspace: str = None, workspace_exclude: List[str] = None, remote_runpath: str = None, testplan_path: str = None, remote_workspace: str = None, clean_remote: bool = False, push: List[Union[str, Tuple]] = None, push_exclude: List[str] = None, delete_pushed: bool = False, fetch_runpath: bool = True, fetch_runpath_exclude: List[str] = None, pull: List[str] = None, pull_exclude: List[str] = None, env: Dict[str, str] = None, setup_script: List[str] = None, status_wait_timeout: int = 60, **options)[source]¶ Bases:
testplan.common.entity.base.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
-
class
testplan.common.remote.remote_resource.
RemoteResourceConfig
(**options)[source]¶ Bases:
testplan.common.remote.remote_resource.UnboundRemoteResourceConfig
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.7/site-packages/rpyc/../../bin/rpyc_classic.py', rpyc_port: str = 0, sigint_timeout: int = 5, **options)[source]¶ Bases:
testplan.common.entity.base.Resource
,testplan.common.remote.remote_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.
- sigint_timeout – number of seconds to wait between
SIGINT
andSIGKILL
Also inherits all
Resource
andRemoteResource
options-
CONFIG
¶ alias of
RemoteServiceConfig
-
class
testplan.common.remote.remote_service.
RemoteServiceConfig
(**options)[source]¶ Bases:
testplan.common.entity.base.ResourceConfig
,testplan.common.remote.remote_resource.RemoteResourceConfig
Configuration object for
RemoteService
entity.
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.