rockandska / pytest-tmux

A pytest plugin that enables tmux driven tests
https://pytest-tmux.readthedocs.io
MIT License
1 stars 0 forks source link
pytest python tmux

pytest-tmux

PyPI version

Python versions

A pytest plugin that enables tmux driven tests

This plugin is intend to help users who want to test interrative cli.

When using tmux fixture it basically :

Warnings

Until a stable release, it is greatly encouraged to specify a strict version if you use this tool in your CI since it is in its early development and could be greatly changed between version.

Docs

https://pytest-tmux.readthedocs.io/

Features

Requirements

Installation

You can install "pytest-tmux" via pip from PyPI:

$ pip install pytest-tmux

Configuration capabilities

Configuration could be set on different level (in order of precedence):

Usage

Basic example

import pytest
from inspect import cleandoc

def test_assert(tmux):
    # Set some options before session / windows is started
    tmux.config.session.window_command='env -i PS1="$ " TERM="xterm-256color" /usr/bin/env bash --norc --noprofile'
    assert tmux.screen() == '$'
    tmux.send_keys(r'printf "  Hello World  .\n\n"')
    expected=r"""
    $ printf "  Hello World  .\n\n"
      Hello World  .

    $
    """
    assert tmux.screen() == cleandoc(expected)

License

Distributed under the terms of the MIT license, "pytest-tmux" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.