コード例 #1
0
def test_changelog(gitrepo):
    os.makedirs('nuws', exist_ok=True)
    files = [('rever.xsh', REVER_XSH),
             ('CHANGELOG.rst', CHANGELOG_RST),
             ('nuws/TEMPLATE.rst', TEMPLATE_RST),
             ('nuws/n0.rst', N0_RST),
             ('nuws/n1.rst', N1_RST),
             ]
    for filename, body in files:
        with open(filename, 'w') as f:
            f.write(body)
    vcsutils.track('.')
    vcsutils.commit('initial changelog and news')
    env_main(['42.1.1'])
    # now see if this worked
    newsfiles = os.listdir('nuws')
    assert 'TEMPLATE.rst' in newsfiles
    assert 'n0.rst' not in newsfiles
    assert 'n1.rst' not in newsfiles
    with open('CHANGELOG.rst') as f:
        cl = f.read()
    assert CHANGELOG_42_1_1 == cl
    # ensure that the updates were commited
    logger = current_logger()
    entries = logger.load()
    assert entries[-2]['rev'] != entries[-1]['rev']
コード例 #2
0
def test_authors(gitrepo):
    vcsutils.tag('42.1.0')
    files = [
        ('rever.xsh', REVER_XSH),
    ]
    for filename, body in files:
        with open(filename, 'w') as f:
            f.write(body)
    vcsutils.track('.')
    vcsutils.commit('initial authors')
    env_main(['42.1.1'])
    # now see if this worked
    files = os.listdir('.')
    assert 'AUTHORS.md' in files
    assert 'authors.yaml' in files
    assert 'Mailmap' in files
    assert 'latest.json' in files
    # test authors file
    with open('AUTHORS.md') as f:
        auth = f.read()
    assert auth.startswith(
        "All of the people who have made at least one contribution to WAKKA.\n"
        "Authors are sorted by number of commits.\n")
    # test latest file
    with open("latest.json") as f:
        latest = json.load(f)
    assert isinstance(latest, list)
    assert len(latest) == 1
    assert isinstance(latest[0], str)
    assert '@' in latest[0]
    # ensure that the updates were commited
    logger = current_logger()
    entries = logger.load()
    assert entries[-2]['rev'] != entries[-1]['rev']
コード例 #3
0
ファイル: test_main.py プロジェクト: cdeil/rever
def test_compute_activities_completed(gitrepo):
    l = current_logger()
    env = builtins.__xonsh__.env
    env['VERSION'] = 'x.y.z'
    l.log('logging a', activity='a', category='activity-end',
          data={'start_rev': 'hi'})
    e = l.load()
    assert compute_activities_completed() == {'a'}
    env['VERSION'] = 'x.y.zz'
    assert compute_activities_completed() == set()
コード例 #4
0
ファイル: test_main.py プロジェクト: takluyver/rever
def test_bad_activities_break(gitrepo):
    with open('rever.xsh', 'w') as f:
        f.write(BAD_GOOD)
    env = builtins.__xonsh__.env
    try:
        env_main(args=['x.y.z'])
        completed = True
    except SystemExit:
        completed = False
    assert not completed
    assert not os.path.isfile('good')
    logger = current_logger()
    for entry in logger.load():
        assert entry['activity'] != 'good'
コード例 #5
0
ファイル: test_version_bump.py プロジェクト: saraedum/rever
def test_version_bump(gitrepo):
    files = [('rever.xsh', REVER_XSH), ('init.py', INIT_PY),
             ('appveyor.yml', APPVEYOR_YML)]
    for filename, body in files:
        with open(filename, 'w') as f:
            f.write(body)
    vcsutils.track('.')
    vcsutils.commit('Some versioned files')
    env_main(['42.1.1'])
    # now see if this worked
    with open('init.py') as f:
        init = f.read()
    assert "__version__ = '42.1.1'\n" == init
    with open('appveyor.yml') as f:
        appveyor = f.read()
    assert appveyor == "version: 42.1.1.{build}\n"
    # ensure that the updates were commited
    logger = current_logger()
    entries = logger.load()
    assert entries[-2]['rev'] != entries[-1]['rev']
コード例 #6
0
def test_tag_activity(gitrepo):
    vcsutils.tag('42.1.0')
    files = [
        ('rever.xsh', REVER_XSH),
    ]
    for filename, body in files:
        with open(filename, 'w') as f:
            f.write(body)
    vcsutils.track('.')
    vcsutils.commit('Some versioned files')
    env_main(['42.1.1'])
    # now see if this worked
    current = vcsutils.latest_tag()
    assert '42.1.1' == current
    # now try to undo the tag
    env_main(['-u', 'tag', '42.1.1'])
    current = vcsutils.latest_tag()
    assert '42.1.0' == current
    # ensure that the updates were commited
    logger = current_logger()
    entries = logger.load()
    assert entries[-2] != entries[-1]