def test_conda_forge_activity(gitrepo, gitecho):
    vcsutils.tag("0.0.1")
    env = builtins.__xonsh__.env
    recipe_dir = os.path.join(env["REVER_DIR"], "rever-feedstock", "recipe")
    meta_yaml = os.path.join(recipe_dir, "meta.yaml")
    os.makedirs(recipe_dir, exist_ok=True)
    files = [
        ("rever.xsh", REVER_XSH),
        (meta_yaml, ORIG_META_YAML),
        ("credfile", CREDFILE),
    ]
    for filename, body in files:
        with open(filename, "w") as f:
            f.write(body)
    vcsutils.track(".")
    vcsutils.commit("Some versioned files")
    env_main(["0.1.0"])
    # now see if this works
    with open(meta_yaml, "r") as f:
        obs = f.read()
    assert EXP_META_YAML == obs

    env_main(["0.2.0"])
    # now see if this works
    with open(meta_yaml, "r") as f:
        obs = f.read()
    assert EXP_META_YAML2 == obs
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']
Beispiel #3
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']
Beispiel #4
0
def test_appimage(gitrepo):
    Path('appimage').mkdir(exist_ok=True)
    files = [('rever.xsh', REVER_XSH), ('setup.py', SETUP_FILE),
             ('appimage/entrypoint.sh', APPIMAGE_ENTRYPOINT_FILE),
             ('appimage/pre-requirements.txt', APPIMAGE_PRE_REQUIREMENTS_FILE),
             ('appimage/xonsh.appdata.xml', APPIMAGE_APPDATA_FILE),
             ('appimage/xonsh.desktop', APPIMAGE_DESKTOP_FILE)]
    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'])
    assert Path('xonsh-x86_64.AppImage') in Path('.').glob('*')
Beispiel #5
0
def test_pypi_activity(gitrepo):
    files = [('rever.xsh', REVER_XSH), ('pypirc', VALID_RC),
             ('setup.py', SETUP_PY)]
    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'])
    env = builtins.__xonsh__.env
    python = env.get('PYTHON')
    out = subprocess.check_output([python, 'setup.py', '--version'],
                                  universal_newlines=True)
    out = out.strip()
    assert '42.1.1' == out
Beispiel #6
0
def test_command_activity(gitrepo):
    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
    assert os.path.exists('test')
    # now try to undo the tag
    env_main(['-u', 'test_command', '42.1.1'])
    assert not os.path.exists('test')
def test_changelog_setup(gitrepo):
    files = [
        ('rever.xsh', SETUP_XSH),
    ]
    for filename, body in files:
        with open(filename, 'w') as f:
            f.write(body)
    vcsutils.track('.')
    vcsutils.commit('initial authors')
    env_main(['setup'])
    # now see if this worked
    files = os.listdir('.')
    assert 'AUTHORS.md' in files
    assert 'Mailmap' in files
    with open('AUTHORS.md') as f:
        auth = f.read()
    assert 'My project is castlehouse\n' == auth
Beispiel #8
0
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']
Beispiel #9
0
def test_changelog_setup(gitrepo):
    os.makedirs('nuws', exist_ok=True)
    files = [('rever.xsh', SETUP_XSH),
             ]
    for filename, body in files:
        with open(filename, 'w') as f:
            f.write(body)
    vcsutils.track('.')
    vcsutils.commit('initial changelog')
    env_main(['setup'])
    # now see if this worked
    newsfiles = os.listdir('nuws')
    assert 'TEMPLATE.rst' in newsfiles
    basefiles = os.listdir('.')
    assert 'CHANGELOG.rst' in basefiles
    with open('CHANGELOG.rst') as f:
        cl = f.read()
    assert 'castlehouse' in cl
    assert '.gitignore' in basefiles
    with open('.gitignore') as f:
        gi = f.read()
    assert '\n# Rever\nrvr/\n' in gi
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]
Beispiel #11
0
def test_conda_forge_activity(gitrepo, gitecho):
    vcsutils.tag('0.0.1')
    env = builtins.__xonsh__.env
    recipe_dir = os.path.join(env['REVER_DIR'], 'rever-feedstock', 'recipe')
    meta_yaml = os.path.join(recipe_dir, 'meta.yaml')
    os.makedirs(recipe_dir, exist_ok=True)
    files = [('rever.xsh', REVER_XSH), (meta_yaml, ORIG_META_YAML),
             ('credfile', CREDFILE)]
    for filename, body in files:
        with open(filename, 'w') as f:
            f.write(body)
    vcsutils.track('.')
    vcsutils.commit('Some versioned files')
    env_main(['0.1.0'])
    # now see if this works
    with open(meta_yaml, 'r') as f:
        obs = f.read()
    assert EXP_META_YAML == obs

    env_main(['0.2.0'])
    # now see if this works
    with open(meta_yaml, 'r') as f:
        obs = f.read()
    assert EXP_META_YAML2 == obs
Beispiel #12
0
def do_tryptophan():
    with open('tryptophan.txt', 'w') as f:
        f.write('5-HTP\n')
    vcsutils.track('tryptophan.txt')
    vcsutils.commit("seratonin")