# libtmux.pytest_plugin.server

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

```
libtmux.pytest_plugin.server(request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch, config_file: pathlib.Path) -> Server
```

Return new, temporary :class:`libtmux.Server`.

>>> from libtmux.server import Server

>>> def test_example(server: Server) -> None:
...     assert isinstance(server, Server)
...     session = server.new_session('my session')
...     assert len(server.sessions) == 1
...     assert [session.name.startswith('my') for session in server.sessions]

.. ::
    >>> locals().keys()
    dict_keys(...)

    >>> source = ''.join([e.source for e in request._pyfuncitem.dtest.examples][:3])
    >>> pytester = request.getfixturevalue('pytester')

    >>> pytester.makepyfile(**{'whatever.py': source})
    PosixPath(...)

    >>> result = pytester.runpytest('whatever.py', '--disable-warnings')
    ===...

    >>> result.assert_outcomes(passed=1)
