Ejemplo n.º 1
0
def test_simple_string_command():
    sh('ls -lrt')
Ejemplo n.º 2
0
def test_pipes():
    result = (sh('tests/cli.tool -o "hello"') | sh('tests/cli.tool -i')).run()
    assert result == ShellCommandResult(stdout='STDIN: STDOUT: hello\n\n')
Ejemplo n.º 3
0
def test_raise_for_status_success():
    assert sh('tests/cli.tool').raise_for_status() == ShellCommandResult()
Ejemplo n.º 4
0
def test_raise_for_status_failure():
    with pytest.raises(CalledProcessError):
        sh('tests/cli.tool -x 42').raise_for_status()
Ejemplo n.º 5
0
def test_simplified_stderr():
    assert sh('tests/cli.tool -e "errput"').stderr == b'STDERR: errput\n'
Ejemplo n.º 6
0
def test_simplified_exit_code():
    assert sh('tests/cli.tool -x 42').exit_code == 42
Ejemplo n.º 7
0
def test_simplified_stdout():
    assert sh('tests/cli.tool -o "output"').stdout == b'STDOUT: output\n'
Ejemplo n.º 8
0
def test_item_access_helper():
    sh['tests/cli.tool']('-o', 'hi') == sh('tests/cli.tool -o hi')
Ejemplo n.º 9
0
def test_attribute_access_helper():
    sh.ls('-lrt') == sh('ls -lrt')
Ejemplo n.º 10
0
def test_bad_type_command():
    with pytest.raises(TypeError):
        sh(1)
Ejemplo n.º 11
0
def test_list_command():
    sh(['ls', '-lrt'])