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