예제 #1
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')
예제 #2
0
def test_raise_for_status_success():
    assert sh('tests/cli.tool').raise_for_status() == ShellCommandResult()
예제 #3
0
def test_stdin_file():
    result = (sh % 'tests/cli.tool -i' < 'tests/test_input.txt').run()
    # One newline belongs to the test file, the other is a standard part of
    # cli.tool's output.
    assert result == ShellCommandResult(stdout='STDIN: Test input file.\n\n')
예제 #4
0
def test_stdin_writing():
    result = (sh % 'tests/cli.tool -i' << 'hi stdin').run()
    assert result == ShellCommandResult(stdout='STDIN: hi stdin\n')
예제 #5
0
def test_stderr_capture():
    result = (sh % 'tests/cli.tool -e "hi there"').run()
    assert result == ShellCommandResult(stderr='STDERR: hi there\n')
예제 #6
0
def test_stdout_capture():
    result = (sh % 'tests/cli.tool -o "hi there"').run()
    assert result == ShellCommandResult(stdout='STDOUT: hi there\n')
예제 #7
0
def test_exit_code():
    result = (sh % 'tests/cli.tool -x 42').run()
    assert result == ShellCommandResult(exit_code=42)
예제 #8
0
def test_can_run():
    result = (sh % 'tests/cli.tool').run()
    assert result == ShellCommandResult()