waft.system.clients.local_client.local_client module

class waft.system.clients.local_client.local_client.LocalClient(connection_details: ConnectionDetails)

Bases: ClientBase

LocalClient class is used for interacting with the local environment as if it were a remote server

bind_remote_port_to_local(remote_port: int, local_port: int | None = None, remote_host: str = '127.0.0.1', local_host: str = '127.0.0.1') AbstractContextManager[int]

Bind a port on the remote machine to a port on localhost. This is intended for use on systems behind a proxy.

Parameters:
  • remote_port – Port number on remote machine to bind to a port on localhost

  • local_port – Port on test runner that should be bound to given remote port (Default: selected dynamically)

  • remote_host – Host on remote port for which the given port is to be forwarded (Default: localhost)

  • local_host – Local host to which given port should be forwarded (Default: localhost)

Yields:

AbstractContextManager[int] – Local port number

exec_command(command: list, input: str | list[str] | None = None, retry_handler: RetryHandler | None = None, expected_exit_code: int | None = 0, auto_raise: bool = True, custom_exception: Type[Exception] | None = None, custom_exception_msg: str | None = None, **kwargs) Result

Run a command on the local machine

get_file(remote_file_path: PurePath, local_file_path: Path) None

Get a file. In local run mode this is the same as copying it.

Parameters:
  • remote_file_path – Presumably the remote file path is the source of the file

  • local_file_path – The local file path is the destination for the file

Returns: None

send_file(remote_file_path: PurePath, local_file_path: Path) None

Send a file. In local run mode this is the same as copying it.

Parameters:
  • remote_file_path – Presumably the remote file path is the destination for the file

  • local_file_path – The local file path is the source of the file

Returns: None