Beispiel #1
0
def test_check_call_capturing_nonzero():
    """
    Test checked-and-capturing execution of a failing subprocess.
    """

    from cargo.io import check_call_capturing

    check_call_capturing([
        os.path.join(os.path.dirname(__file__), "echo_and_exit"),
        "foo bar baz",
        "42",
    ])
Beispiel #2
0
def test_check_call_capturing_nonzero():
    """
    Test checked-and-capturing execution of a failing subprocess.
    """

    from cargo.io   import check_call_capturing

    check_call_capturing(
        [
            os.path.join(os.path.dirname(__file__), "echo_and_exit"),
            "foo bar baz",
            "42",
            ]
        )
Beispiel #3
0
def test_check_call_capturing_zero():
    """
    Test checked-and-capturing execution of a non-failing subprocess.
    """

    from nose.tools import assert_equal
    from cargo.io   import check_call_capturing

    (stdout, stderr) = \
        check_call_capturing(
            [
                os.path.join(os.path.dirname(__file__), "echo_and_exit"),
                "foo bar baz",
                "0",
                ]
            )

    assert_equal(stdout, "foo bar baz\n")
    assert_equal(stderr, "")
Beispiel #4
0
def test_check_call_capturing_zero():
    """
    Test checked-and-capturing execution of a non-failing subprocess.
    """

    from nose.tools import assert_equal
    from cargo.io import check_call_capturing

    (stdout, stderr) = \
        check_call_capturing(
            [
                os.path.join(os.path.dirname(__file__), "echo_and_exit"),
                "foo bar baz",
                "0",
                ]
            )

    assert_equal(stdout, "foo bar baz\n")
    assert_equal(stderr, "")