Codebase list python-procrunner / 9bb50456-44d4-4ae4-9c9b-a05b35c3e734/main docs / usage.rst

Tree @9bb50456-44d4-4ae4-9c9b-a05b35c3e734/main (Download .tar.gz)

usage.rst @9bb50456-44d4-4ae4-9c9b-a05b35c3e734/mainraw · history · blame


To use ProcRunner in a project::

    import procrunner
    result =['/bin/ls', '/some/path/containing spaces'])

To test for successful completion::

    assert not result.returncode
    assert result.returncode == 0  # alternatively
    result.check_returncode()  # raises subprocess.CalledProcessError()

To test for no STDERR output::

    assert not result.stderr
    assert result.stderr == b''  # alternatively

To run with a specific environment variable set::

    result =, environment_override={ 'VARIABLE': 'value' })

To run with a specific environment::

    result =, environment={ 'VARIABLE': 'value' })

To run in a specific directory::

    result =, working_directory='/some/path')