Exemplo n.º 1
0
def test_failing_command_rises(commands):
    """Test that a failing command raises."""
    context = LaunchContext()
    command = Command(commands['failing'])
    with pytest.raises(SubstitutionFailure) as ex:
        command.perform(context)
    ex.match('executed command failed. Command: .*failing_command')
Exemplo n.º 2
0
def test_missing_command_raises(commands):
    """Test that a command that doesn't exist raises."""
    context = LaunchContext()
    command = Command('ros2_launch_test_command_i_m_not_a_command')
    with pytest.raises(SubstitutionFailure) as ex:
        command.perform(context)
    ex.match('file not found:')
Exemplo n.º 3
0
def test_command_with_stderr_raises(commands):
    """Test that a command that produces stderr raises."""
    context = LaunchContext()
    command = Command(commands['with_stderr'])
    with pytest.raises(SubstitutionFailure) as ex:
        command.perform(context)
    ex.match(
        'executed command showed stderr output. Command: .*command_with_stderr'
        r'[\w\W]*asd bsd')
Exemplo n.º 4
0
def test_command_with_stderr_capture(commands):
    """Test `Command` substitution with `on_stderr='capture'`."""
    context = LaunchContext()
    command = Command(commands['with_stderr'], on_stderr='capture')
    output = command.perform(context)
    assert output == 'asd bsd\n'
Exemplo n.º 5
0
def test_command_with_stderr_warn(commands):
    """Test `Command` substitution with `on_stderr='warn'`."""
    context = LaunchContext()
    command = Command(commands['with_stderr'], on_stderr='warn')
    output = command.perform(context)
    assert output == ''
Exemplo n.º 6
0
def test_command_with_stderr_ignored(commands):
    """Test `Command` substitution ignoring stderr."""
    context = LaunchContext()
    command = Command(commands['with_stderr'], on_stderr='ignore')
    output = command.perform(context)
    assert output == ''
Exemplo n.º 7
0
def test_command(commands):
    """Test a simple command."""
    context = LaunchContext()
    command = Command(commands['normal'])
    output = command.perform(context)
    assert output == 'asd bsd csd\n'