Exemplo n.º 1
0
def step_undefined_step_snippet_should_not_exist_for(context, step):
    """
    Checks if an undefined-step snippet is provided for a step
    in behave command output (last command).
    """
    undefined_step_snippet  = make_undefined_step_snippet(step)
    context.execute_steps(u'''\
Then the command output should not contain:
    """
    {undefined_step_snippet}
    """
    '''.format(undefined_step_snippet=text_indent(undefined_step_snippet, 4)))
Exemplo n.º 2
0
def step_undefined_step_snippet_should_not_exist_for(context, step):
    """
    Checks if an undefined-step snippet is provided for a step
    in behave command output (last command).
    """
    undefined_step_snippet = make_undefined_step_snippet(step)
    context.execute_steps(u'''\
Then the command output should not contain:
    """
    {undefined_step_snippet}
    """
    '''.format(undefined_step_snippet=text_indent(undefined_step_snippet, 4)))
Exemplo n.º 3
0
    runner = Runner(config)
    try:
        failed = runner.run()
    except ParserError, e:
        sys.exit(str(e))
    except ConfigError, e:
        sys.exit(str(e))

    if config.show_snippets and runner.undefined:
        msg = u"\nYou can implement step definitions for undefined steps with "
        msg += u"these snippets:\n\n"
        printed = set()
        for step in runner.undefined:
            if step in printed:
                continue
            printed.add(step)
            msg += make_undefined_step_snippet(step)

        # -- OOPS: Unclear if stream supports ANSI coloring.
        sys.stderr.write(escapes['undefined'] + msg + escapes['reset'])
        sys.stderr.flush()

    if failed:
        sys.exit(1)
    # -- OTHERWISE: Successful run.
    sys.exit(0)

if __name__ == '__main__':
    main()
Exemplo n.º 4
0
    runner = Runner(config)
    try:
        failed = runner.run()
    except ParserError, e:
        sys.exit(str(e))
    except ConfigError, e:
        sys.exit(str(e))

    if config.show_snippets and runner.undefined:
        msg = u"\nYou can implement step definitions for undefined steps with "
        msg += u"these snippets:\n\n"
        printed = set()
        for step in runner.undefined:
            if step in printed:
                continue
            printed.add(step)
            msg += make_undefined_step_snippet(step)

        # -- OOPS: Unclear if stream supports ANSI coloring.
        sys.stderr.write(escapes['undefined'] + msg + escapes['reset'])
        sys.stderr.flush()

    if failed:
        sys.exit(1)
    # -- OTHERWISE: Successful run.
    sys.exit(0)

if __name__ == '__main__':
    main()