Testing Infrastructure¶
Helpers and utilities for various Bakeneko tests
- class bakeneko.support.test.BakenekoRemoteTest(*args, **kwargs)¶
Run
unitest
based test cases that interact with a remote host over SSH.- Attributes:
REMOTE_HOST (str | None) – The remote host to connect to. If not overloaded it reads the value from the
BAKENEKO_REMOTE_TEST_HOST
environment variable if it exists, otherwise the value isNone
.REMOTE_USER (str | None) – The user on the remote host to connect as. If not overloaded it reads the value from the
BAKENEKO_REMOTE_TEST_USER
environment variable if it exits, otherwise the value isNone
.REMOTE_KEY (str | None) – The private key file to use for remote authentication. If not overloaded it reads the value from the
BAKENEKO_REMOTE_TEST_KEY
environment variable if it exits, otherwise the value isNone
.LONG_LIVED (bool) – If the remote connection is long-lived. If set to true, the connection will be established on construction of the test class and live for every single test case run. Otherwise, the connection is established prior to each
test_
case and torn down after. (default: True)
- remote_put_file(file: Path | IOBase, dest: str)¶
Send a file to the remote system :type file:
Path
|IOBase
:param file: The file to upload. :type file: Path | IOBase :type dest:str
:param dest: The destination for the file. :type dest: str- Returns:
fabric.transfer.Result – If the connection is active and valid, the result of the file transfer.
None – If there is no remote connection.
- Raises:
AssertionError – If the put on the remote connection fails for any reason.
- remote_run_cmd(cmd: str, **kwargs)¶
Run a command on the remote system.
- Parameters:
cmd (str) – The command to run on the remote system.
- Returns:
invoke.runners.Result – If the connection is active and valid, the result of the command.
None – If there is no remote connection.
- Raises:
AssertionError – If the run on the remote connection fails for any reason.
- assertRemoteConnected()¶
Assert that we are connected to the remote session
- class bakeneko.support.test.BakenekoSerialTest(*args, **kwargs)¶
Run
unitest
based test cases that interact with a DUT over serial- Attributes:
SERIAL_PORT (str | None) – The serial port to connect to. If not overloaded it reads the value from the
BAKENEKO_SERIAL_TEST_PORT
environment variable if it exists, otherwise the value isNone
.REMOTE_USER (int) – The user on the remote host to connect as. If not overloaded it reads the value from the
BAKENEKO_SERIAL_TEST_BAUD
environment variable if it exists. (default: 115200)
- LONG_LIVEDbool
If the serial connection is long-lived. If set to true, the connection will be established on construction of the test class and live for every single test case run. Otherwise, the connection is established prior to each
test_
case and torn down after. (default: True)