Exemple #1
0
def test3():
    """command given, new commit created, do not rebuild or merge"""
    datafile = 'tests/fixtures/rebuild_merge/3_issue.yml'
    statusfile = 'tests/fixtures/rebuild_merge/3_prstatus.json'
    with get_issue(datafile, statusfile) as iw:
        meta = {
            'is_pullrequest': True,
            'is_needs_revision': False,
            'is_needs_rebase': False,
            'needs_rebuild': False,
            'ci_run_number': 0
        }
        rbfacts = get_rebuild_merge_facts(iw, meta, ['superman'], ShippableCI('', iw))
        assert not rbfacts['needs_rebuild']
        assert not rbfacts['needs_rebuild_all']
        assert not rbfacts['admin_merge']
Exemple #2
0
def test0():
    """command issued, test ran, time to merge"""
    datafile = 'tests/fixtures/rebuild_merge/0_issue.yml'
    statusfile = 'tests/fixtures/rebuild_merge/0_prstatus.json'
    with get_issue(datafile, statusfile) as iw:
        meta = {
            'is_pullrequest': True,
            'is_needs_revision': False,
            'is_needs_rebase': False,
            'needs_rebuild': False,
            'ci_run_number': 0,
        }
        rbfacts = get_rebuild_merge_facts(iw, meta, ['superman'], ShippableCI('', iw))
        assert not rbfacts['needs_rebuild']
        assert not rbfacts['needs_rebuild_all']
        assert rbfacts['admin_merge']
Exemple #3
0
def test1():
    """new test is in progress, do not rebuild and do not merge"""
    datafile = 'tests/fixtures/rebuild_merge/1_issue.yml'
    statusfile = 'tests/fixtures/rebuild_merge/1_prstatus.json'
    with get_issue(datafile, statusfile) as iw:
        meta = {
            'is_pullrequest': True,
            'is_needs_revision': False,
            'is_needs_rebase': False,
            'needs_rebuild': False,
            'ci_run_number': 0
        }
        rbfacts = get_rebuild_merge_facts(iw, meta, ['superman'], ShippableCI('', iw))
        assert not rbfacts['needs_rebuild']
        assert not rbfacts['needs_rebuild_all']
        assert not rbfacts['admin_merge']
Exemple #4
0
def test_rebuild_failed_and_rebuild_commands():
    """Test ran and failed. /rebuild_failed and /rebuild commands issued, in that order."""
    datafile = u'tests/fixtures/rebuild/3_issue.yml'
    statusfile = u'tests/fixtures/rebuild/3_prstatus.json'
    with get_issue(datafile, statusfile) as iw:
        meta = {
            u'is_pullrequest': True,
            u'is_needs_revision': False,
            u'is_needs_rebase': False,
            u'needs_rebuild': False,
            u'ci_run_number': 0,
        }
        rbfacts = get_rebuild_command_facts(iw, meta, ShippableCI('', iw))
        assert rbfacts[u'needs_rebuild']
        assert rbfacts[u'needs_rebuild_all']
        assert not rbfacts[u'needs_rebuild_failed']
Exemple #5
0
def test_rebuild_failed_command():
    """Test ran and failed. /rebuild_failed command issued."""
    datafile = 'tests/fixtures/rebuild/1_issue.yml'
    statusfile = 'tests/fixtures/rebuild/1_prstatus.json'
    with get_issue(datafile, statusfile) as iw:
        meta = {
            'is_pullrequest': True,
            'is_needs_revision': False,
            'is_needs_rebase': False,
            'needs_rebuild': False,
            'ci_run_number': 0,
        }
        rbfacts = get_rebuild_command_facts(iw, meta, ShippableCI('', iw))
        assert rbfacts['needs_rebuild']
        assert rbfacts['needs_rebuild_failed']
        assert not rbfacts['needs_rebuild_all']
Exemple #6
0
def test2():
    """command given, time to rebuild but not merge"""
    datafile = u'tests/fixtures/rebuild_merge/2_issue.yml'
    statusfile = u'tests/fixtures/rebuild_merge/2_prstatus.json'
    with get_issue(datafile, statusfile) as iw:
        meta = {
            u'is_pullrequest': True,
            u'is_needs_revision': False,
            u'is_needs_rebase': False,
            u'needs_rebuild': False,
            u'ci_run_number': 0
        }
        rbfacts = get_rebuild_merge_facts(iw, meta, [u'superman'],
                                          ShippableCI('', iw))
        assert rbfacts[u'needs_rebuild']
        assert rbfacts[u'needs_rebuild_all']
        assert not rbfacts[u'admin_merge']