client
TmuxClient(request, pytestconfig, tmpdir_factory=None, server=None, server_cfg_fixture=None, session_cfg_fixture=None, assertion_cfg_fixture=None)
When instantiated
- create/stores link to :
- libtmux.server.Server instance
- libtmux.session.Session instance
- libtmux.window.Window instance
- libtmux.pane.Pane instance
- create some methods specific to pytest-tmux
- create a pytest_tmux.config.TmuxConfig instance
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request |
pytest.FixtureRequest
|
a pytest request fixture object |
required |
pytestconfig |
pytest.Config
|
a pytest pytestconfig fixture object |
required |
tmpdir_factory |
Optional[pytest.TempdirFactory]
|
a pytest tmpdir_factory fixture object |
None
|
server |
Optional[TmuxServer]
|
a libtmux.server.server object |
None
|
server_cfg_fixture |
Optional[Dict[str, Union[str, int]]]
|
a server config dictionary |
None
|
session_cfg_fixture |
Optional[Dict[str, Union[str, int]]]
|
a session config dictionary |
None
|
assertion_cfg_fixture |
Optional[Dict[str, Union[str, int]]]
|
a assertion config dictionary |
None
|
Source code in pytest_tmux/client.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
pane: Optional[libtmux.pane.Pane]
property
A direct link to libtmux.pane.Pane created for the actual test.
The object is created on the first call who need it.
Returns:
Type | Description |
---|---|
Optional[libtmux.pane.Pane]
|
a libtmux.pane.Pane object |
server: libtmux.server.Server
property
A direct link to libtmux.server.Server created for the actual test session.
The object is created on the first call who need it.
Returns:
Type | Description |
---|---|
libtmux.server.Server
|
a libtmux.server.Server object |
session: libtmux.session.Session
property
A direct link to libtmux.session.Session created for the actual test.
The object is created on the first call who need it.
Returns:
Type | Description |
---|---|
libtmux.session.Session
|
a libtmux.session.Session object |
window: libtmux.window.Window
property
A direct link to libtmux.window.Window created for the actual test.
The object is created on the first call who need it.
Returns:
Type | Description |
---|---|
libtmux.window.Window
|
a libtmux.window.Window object |
clear()
Shortcut for libtmux.pane.Pane.clear()
Source code in pytest_tmux/client.py
225 226 227 228 229 230 |
|
debug(msg)
Display a message and ask to press enter when pytest-tmux debug is activated.
On first call, display a command who let the user been attached to the test session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
msg |
str
|
The message to display |
required |
Source code in pytest_tmux/client.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
row(row, timeout=None, delay=None)
Get row content from pane with retry capability on operators
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row |
int
|
which row from libtmux.pane.Pane.capture_pane to set in TmuxOutput |
required |
timeout |
Optional[int]
|
how long to wait for the assertion to failed |
None
|
delay |
Optional[Union[int, float]]
|
how long before retrying the assertion |
None
|
Returns:
Type | Description |
---|---|
TmuxOutput
|
a TmuxOutput instance |
Source code in pytest_tmux/client.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
|
screen(timeout=None, delay=None)
Get screen content from pane with retry capability on operators
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout |
Optional[int]
|
how long to wait for the assertion to failed |
None
|
delay |
Optional[Union[int, float]]
|
how long before retrying the assertion |
None
|
Returns:
Type | Description |
---|---|
TmuxOutput
|
a TmuxOutput instance |
Source code in pytest_tmux/client.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
|
send_keys(cmd, **kwargs)
Send commands to the actual pane
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cmd |
str
|
Text or input into pane |
required |
kwargs |
Any
|
every arguments accepted by libtmux.pane.Pane.send_keys() |
{}
|
Source code in pytest_tmux/client.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
|