# libtmux.pytest_plugin.TestServer

- **Module:** libtmux.pytest_plugin
- **Package:** libtmux
- **Language:** Python
- **Kind:** function
- **Source:** https://github.com/tmux-python/libtmux/blob/036c521c4b83ce6e434eb50afe2a0d08a6a05e46/src/libtmux/pytest_plugin.py#L325
- **Page:** https://libtmux.org/reference/py/libtmux-pytest_plugin-testserver/

```
libtmux.pytest_plugin.TestServer(request: pytest.FixtureRequest) -> type[Server]
```

Create a temporary tmux server that cleans up after itself.

This is similar to the server pytest fixture, but can be used outside of pytest.
The server will be killed when the test completes.

## Example

```python
>>> server = Server()  # Create server instance
>>> server.new_session()
Session($... ...)
>>> server.is_alive()
True
>>> # Each call creates a new server with unique socket
>>> server2 = Server()
>>> server2.socket_name != server.socket_name
True
```
