test_process.py 695 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""Test common.util.process."""

from superbench.common.utils import run_command


def test_run_command():
    """Test run_command."""
    command = 'echo 123'
    expected_output = '123\n'
    output = run_command(command)
    assert (output.stdout == expected_output)
    assert (output.returncode == 0)
    output = run_command(command, flush_output=True)
    assert (output.stdout == expected_output)
    assert (output.returncode == 0)

    command = 'abb'
    output = run_command(command)
    assert (output.returncode != 0)
    output = run_command(command, flush_output=True)
    assert (output.returncode != 0)