Exemple #1
0
def test_update_results_old():
    """ update_results() updates results

    Because of the design of the our updates (namely that they silently
    incrementally update from x to y) it's impossible to konw exactly what
    we'll get at th end without having tests that have to be reworked each time
    updates are run. Since there already is (at least for v0 -> v1) a fairly
    comprehensive set of tests, this test only tests that update_results() has
    been set equal to the CURRENT_JSON_VERSION, (which is one of the effects of
    runing update_results() with the assumption that there is sufficient other
    testing of the update process.

    """
    data = utils.JSON_DATA.copy()
    data['results_version'] = 0

    with utils.tempdir() as d:
        with open(os.path.join(d, 'main'), 'w') as f:
            json.dump(data, f)

        with open(os.path.join(d, 'main'), 'r') as f:
            base = results.TestrunResult(f)

        res = results.update_results(base, f.name)

    nt.assert_equal(res.results_version, results.CURRENT_JSON_VERSION)
Exemple #2
0
def test_update_results_old():
    """ update_results() updates results

    Because of the design of the our updates (namely that they silently
    incrementally update from x to y) it's impossible to konw exactly what
    we'll get at th end without having tests that have to be reworked each time
    updates are run. Since there already is (at least for v0 -> v1) a fairly
    comprehensive set of tests, this test only tests that update_results() has
    been set equal to the CURRENT_JSON_VERSION, (which is one of the effects of
    runing update_results() with the assumption that there is sufficient other
    testing of the update process.

    """
    data = utils.JSON_DATA.copy()
    data['results_version'] = 0

    with utils.tempdir() as d:
        with open(os.path.join(d, 'main'), 'w') as f:
            json.dump(data, f)

        with open(os.path.join(d, 'main'), 'r') as f:
            base = results.TestrunResult.load(f)

        res = results.update_results(base, f.name)

    nt.assert_equal(res.results_version, results.CURRENT_JSON_VERSION)
Exemple #3
0
def test_update_results_current():
    """ update_results() returns early when the results_version is current """
    data = utils.JSON_DATA.copy()
    data['results_version'] = results.CURRENT_JSON_VERSION

    with utils.tempdir() as d:
        with open(os.path.join(d, 'main'), 'w') as f:
            json.dump(data, f)

        with open(os.path.join(d, 'main'), 'r') as f:
            base = results.TestrunResult(f)

        res = results.update_results(base, f.name)

    nt.assert_dict_equal(res.__dict__, base.__dict__)
Exemple #4
0
def test_update_results_current():
    """ update_results() returns early when the results_version is current """
    data = utils.JSON_DATA.copy()
    data['results_version'] = results.CURRENT_JSON_VERSION

    with utils.tempdir() as d:
        with open(os.path.join(d, 'main'), 'w') as f:
            json.dump(data, f)

        with open(os.path.join(d, 'main'), 'r') as f:
            base = results.TestrunResult.load(f)

        res = results.update_results(base, f.name)

    nt.assert_dict_equal(res.__dict__, base.__dict__)