stderr_mock
Enhanced stderr mock that combines BytesIO functionality with channel support.
StderrMock
Bases: BytesIO
Enhanced stderr mock that extends BytesIO and adds channel functionality. This simulates the behavior of paramiko's stderr which has both read() capabilities and a channel with recv_exit_status() method.
Source code in src/paramiko_mock/stderr_mock.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
__init__(initial_bytes=b'', exit_status=0)
Initialize the stderr mock with initial data and exit status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_bytes
|
bytes
|
Initial bytes for the stderr content |
b''
|
exit_status
|
int
|
The exit status code for the channel |
0
|
Source code in src/paramiko_mock/stderr_mock.py
15 16 17 18 19 20 21 22 23 24 | |
get_exit_status()
Get the current exit status.
Returns:
| Type | Description |
|---|---|
int
|
The current exit status code |
Source code in src/paramiko_mock/stderr_mock.py
35 36 37 38 39 40 41 42 | |
set_exit_status(exit_status)
Set the exit status for the channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exit_status
|
int
|
The exit status code to set |
required |
Source code in src/paramiko_mock/stderr_mock.py
26 27 28 29 30 31 32 33 | |