예제 #1
0
def test_get_student_out_finds_main_out_if_no_postprocess():
    env = Environment(falconf_string="""
    test:
        main: python testMain.py
    """)
    flyer = Flyer(mode='test', env=env)
    flyer.create_sequence()
    flyer.run_sequence()
    formatter = Formatter(flyer)
    steps = formatter.parse_steps(flyer)
    assert 'student_outtttt' in formatter.get_student_out(flyer)
예제 #2
0
def test_get_is_correct_is_none_if_no_tag():
    env = Environment(falconf_string="""
    test:
        main: python testMain.py
    """)
    flyer = Flyer(mode='test', env=env)
    flyer.create_sequence()
    flyer.run_sequence()
    formatter = Formatter(flyer)
    steps = formatter.parse_steps(flyer)
    student_out = formatter.get_student_out(flyer)
    assert formatter.get_is_correct(student_out) is None
예제 #3
0
def test_get_student_out_finds_udacity_out_if_no_postprocess():
    env = Environment(falconf_string="""
    test:
        main: python testMain.py
    """)
    msg = 'this is a message'
    flyer = Flyer(mode='test', env=env)
    flyer.create_sequence()
    flyer.run_sequence()
    formatter = Formatter(flyer)
    steps = formatter.parse_steps(flyer)
    write_udacity_out(msg)
    assert msg in formatter.get_student_out(flyer)
예제 #4
0
def test_get_is_correct_is_false_if_fail_tag():
    # manually passes in output
    env = Environment(falconf_string="""
    test:
        main: echo '<::FAIL>'
    """)
    flyer = Flyer(mode='test', env=env)
    flyer.create_sequence()
    flyer.run_sequence()
    formatter = Formatter(flyer)
    steps = formatter.parse_steps(flyer)
    student_out = formatter.get_student_out(flyer)
    assert not formatter.get_is_correct(student_out)
예제 #5
0
def fly(args, falconf, env):
    """
    Take off! Build the sequence and execute it.

    Args:
        args (dict): From argparse.
        falconf (string): falconf.yaml contents.
        env (Environment)

    Returns:
        Flyer
    """
    start_time = CURRENT_MILLI_TIME()
    env.parse_falconf(falconf)
    flyer = Flyer(mode=args['mode'], debug=args['debug'], env=env)
    flyer.create_sequence()
    flyer.run_sequence()
    end_time = CURRENT_MILLI_TIME()
    ELAPSED_TIME = end_time - start_time
    return flyer