Ejemplo n.º 1
0
def test_pipe_timeout():
    uuid = upload_submission(
        {
            "uuid": None,
            "package": {
                "name": "test-pipe",
                "version": 1455108897,
                "url": "http://127.0.0.1:5000/repo/test-pipe.zip"
            },
            "config": "gcc-cpp",
            "features": ["async_report"]
        }, 'contrib/submission/test-pipe-timeout/')

    evl = fetch_evaluation(uuid)
    tests = convert_test_list(evl['tests'])
    print(json.dumps(evl, indent=4))

    assert evl['score'] == 0

    assert tests['test1']['status'] == 'hard_timeout'
    assert tests['test1']['time'] == 1500
    assert tests['test1']['timeout'] == 1000
    assert tests['test1']['points'] == 0
    assert tests['test1']['max_points'] == 1

    assert tests['test2']['status'] == 'hard_timeout'
    assert tests['test2']['time'] == 1500
    assert tests['test2']['timeout'] == 1000
    assert tests['test2']['points'] == 0
    assert tests['test2']['max_points'] == 1
Ejemplo n.º 2
0
def test_file_bad():
    uuid = upload_submission(
        {
            "uuid": None,
            "package": {
                "name": "test-file",
                "version": 1455108897,
                "url": "http://127.0.0.1:5000/repo/test-file.zip"
            },
            "config": "gcc-cpp",
            "features": ["async_report"]
        }, 'contrib/submission/test-file-bad/')

    evl = fetch_evaluation(uuid)
    tests = convert_test_list(evl['tests'])
    print(json.dumps(evl, indent=4))

    assert evl['status'] == 'compile_error'
    assert evl['score'] == 0
    assert evl['tests'] == []
    assert 'nonexistent_method' in evl['message']
    assert 'not declared' in evl['message']
Ejemplo n.º 3
0
def test_file_good():
    uuid = upload_submission(
        {
            "uuid": None,
            "package": {
                "name": "test-file",
                "version": 1455108897,
                "url": "http://127.0.0.1:5000/repo/test-file.zip"
            },
            "config": "gcc-cpp",
            "features": ["async_report"]
        }, 'contrib/submission/test-file-good/')

    evl = fetch_evaluation(uuid)
    tests = convert_test_list(evl['tests'])
    print(json.dumps(evl, indent=4))

    assert evl['status'] == 'ok'
    assert evl['score'] == 25
    assert tests['test1']['status'] == 'ok'
    assert tests['test2']['status'] == 'bad_answer'
    assert tests['test3']['status'] == 'hard_timeout'
    assert tests['test4']['status'] == 'soft_timeout'