Ejemplo n.º 1
0
def test_command_with_short_option_filter(filter):
    (command, errors) = parse(['-' + filter.short_option, 'test', 'true'])
    assert not errors
    assert isinstance(command, ExecuteCommand)
    assert command.args == ['true']
    transformer = TransformerBuilder.make_transformer(re.compile('test'),
                                                      filter)
    assert command.stdout_transformer == transformer
    assert command.stderr_transformer == transformer
Ejemplo n.º 2
0
def test_command_with_option_remaining_args_separator_with_long_option_filter(
        filter):
    (command, errors) = parse(
        ['--' + filter.long_option, 'test', '--', 'true', '--option'])
    assert not errors
    assert isinstance(command, ExecuteCommand)
    assert command.args == ['true', '--option']
    transformer = TransformerBuilder.make_transformer(re.compile('test'),
                                                      filter)
    assert command.stdout_transformer == transformer
    assert command.stderr_transformer == transformer
Ejemplo n.º 3
0
def test_filter_long_option(filter):
    (command, errors) = parse(['--' + filter.long_option, 'test'])
    assert not errors
    assert isinstance(command, STDINCommand)
    assert command.transformer == TransformerBuilder.make_transformer(
        re.compile('test'), filter)
Ejemplo n.º 4
0
def test_config_file_by_relative_path_without_extension_long_option():
    (command, errors) = parse(['--config', u'tests/data/cfg/config006'])
    assert not errors
    assert isinstance(command, STDINCommand)
    assert command.transformer == TransformerBuilder.make_transformer(
        re.compile(u'ERROR'), FILTERS_BY_NAME['foreground-red'])