예제 #1
0
def get_pr(source_ref):
    status = ci_get('/status', status_code=200)
    assert 'prs' in status
    assert '_watched_targets' in status
    all_prs = [PR.from_json(x) for x in status['prs']]
    prs = [pr for pr in all_prs if pr.source.ref.name == source_ref]
    assert len(prs) == 1, [str(x.source.ref) for x in all_prs]
    return prs[0]
예제 #2
0
파일: test-ci.py 프로젝트: lfrancioli/hail
def get_pr(source_ref):
    status = ci_get('/status', status_code=200)
    assert 'prs' in status
    assert '_watched_targets' in status
    all_prs = [PR.from_json(x) for x in status['prs']]
    prs = [pr for pr in all_prs if pr.source.ref.name == source_ref]
    assert len(prs) == 1, [str(x.source.ref) for x in all_prs]
    return prs[0]
예제 #3
0
def poll_until_pr_exists_and(source_ref,
                             poll_until_true,
                             delay_in_seconds=DELAY_IN_SECONDS,
                             max_polls=MAX_POLLS):
    prs = []
    polls = 0
    while (len(prs) == 0 or not poll_until_true(prs[0])) and polls < max_polls:
        time.sleep(delay_in_seconds)
        status = ci_get('/status', status_code=200)
        assert 'prs' in status
        assert '_watched_targets' in status
        all_prs = [PR.from_json(x) for x in status['prs']]
        prs = [pr for pr in all_prs if pr.source.ref.name == source_ref]
        assert len(prs) <= 1, [str(x.source.ref) for x in all_prs]
        polls = polls + 1
    assert len(prs) == 1
    return prs[0]
예제 #4
0
파일: test-ci.py 프로젝트: lfrancioli/hail
def poll_until_pr_exists_and(source_ref,
                             poll_until_true,
                             delay_in_seconds=DELAY_IN_SECONDS,
                             max_polls=MAX_POLLS):
    prs = []
    polls = 0
    while (len(prs) == 0
           or not poll_until_true(prs[0])) and polls < max_polls:
        time.sleep(delay_in_seconds)
        status = ci_get('/status', status_code=200)
        assert 'prs' in status
        assert '_watched_targets' in status
        all_prs = [PR.from_json(x) for x in status['prs']]
        prs = [pr for pr in all_prs if pr.source.ref.name == source_ref]
        assert len(prs) <= 1, [str(x.source.ref) for x in all_prs]
        polls = polls + 1
    assert len(prs) == 1
    return prs[0]