Exemple #1
0
def test_system():
    def check_system(data_file):
        data_input, data_output = helpers.get_data("test/data/system",
                                                   data_file)
        with open(data_input) as input_file:
            run_full_system(input_file, data_output)

    for data_file in helpers.get_input_files("test/data/system"):
        yield check_system, data_file
Exemple #2
0
def test_input_file():
    inputs = helpers.get_input_files("test/data/cli")

    for input_name in inputs:
        yield check_by_input_file, input_name
Exemple #3
0
def test_input_file():
    inputs = helpers.get_input_files("test/data/cli")

    for input_name in inputs:
        yield check_by_input_file, input_name
Exemple #4
0
        finally:
            sys.stderr = orig_stderr


# helper for system tests


def run_full_system(input_stream, expected_output):
    mock_io = mock.Mock()
    mock_io.stdout = StringIO.StringIO()
    mock_io.stdin = input_stream
    mock_io.argv = ['test']

    def scorer(teams_data):
        return {name: data["zone"] for name, data in teams_data.items()}

    main.main(scorer, io=mock_io)

    output = yaml.load(mock_io.stdout.getvalue())
    assert output == expected_output


for data_file in helpers.get_input_files("test/data/system"):

    @nose.istest
    def test_system():
        data_input, data_output = helpers.get_data("test/data/system",
                                                   data_file)
        with open(data_input) as input_file:
            run_full_system(input_file, data_output)
Exemple #5
0
            output = sys.stderr.getvalue()
            assert 'Traceback' in output
            assert exception_message in output
        finally:
            sys.stderr = orig_stderr

# helper for system tests

def run_full_system(input_stream, expected_output):
    mock_io = mock.Mock()
    mock_io.stdout = StringIO.StringIO()
    mock_io.stdin = input_stream
    mock_io.argv = ['test']

    def scorer(teams_data):
        return {name: data["zone"] for name, data in teams_data.items()}

    main.main(scorer, io = mock_io)

    output = yaml.load(mock_io.stdout.getvalue())
    assert output == expected_output

for data_file in helpers.get_input_files("test/data/system"):
    @nose.istest
    def test_system():
        data_input, data_output = helpers.get_data("test/data/system",
                                                   data_file)
        with open(data_input) as input_file:
            run_full_system(input_file, data_output)