예제 #1
0
def test_get_signatures_with_results(vcs):
    assert get_signatures_with_results(vcs) == []

    os.makedirs(_get_results_directory(vcs, 'signature1'))
    assert get_signatures_with_results(vcs) == ['signature1']

    os.makedirs(_get_results_directory(vcs, 'signature2'))
    assert set(get_signatures_with_results(vcs)) == set(
        ['signature1', 'signature2'])
예제 #2
0
def test_get_signatures_with_results(vcs):
    assert get_signatures_with_results(vcs) == []

    os.makedirs(_get_results_directory(vcs, 'signature1'))
    assert get_signatures_with_results(vcs) == ['signature1']

    os.makedirs(_get_results_directory(vcs, 'signature2'))
    assert set(get_signatures_with_results(vcs)) == set(
        ['signature1', 'signature2'])
예제 #3
0
def gc(ctx):
    """Runs housekeeping tasks to free up space.

    For now, this only removes saved but unused (unreachable) test results.
    """
    vcs = ctx.obj['vcs']
    count = 0
    with locking.lock(vcs, locking.Lock.tests_history):
        known_signatures = set(get_committed_signatures(vcs) + get_staged_signatures(vcs))
        for signature in get_signatures_with_results(vcs):
            if signature not in known_signatures:
                count += 1
                remove_results(vcs, signature)
    click.echo('Removed {} saved results.'.format(count))