def test_without_build_number():
    from setuptools_scm.version import format_version, ScmVersion

    assert format_version(ScmVersion('1.0'),
                          version_scheme='guess-next-dev',
                          local_scheme='node-date-and-build-number') == '1.0'
    assert format_version(ScmVersion('1.0', distance=1, node='baadf00d'),
                          version_scheme='guess-next-dev',
                          local_scheme='node-date-and-build-number') == '1.1.dev1+baadf00d'
Ejemplo n.º 2
0
def test_version2str():
    ver = ScmVersion('1.0', distance=0)
    ver_str = integration.version2str(ver)
    assert ver_str == '1.0'
    ver = ScmVersion('1.0', distance=1)
    ver_str = integration.version2str(ver)
    assert ver_str == '1.0.post0.dev1'
    ver = ScmVersion('1.0.dev0', distance=1)
    ver_str = integration.version2str(ver)
    assert ver_str == '1.0.post0.dev1'
def test_with_build_number(monkeypatch):
    from setuptools_scm.version import format_version, ScmVersion

    monkeypatch.setenv('BUILD_NUMBER', '42')

    assert format_version(ScmVersion('1.0'),
                          version_scheme='guess-next-dev',
                          local_scheme='node-date-and-build-number') == '1.0+b42'
    assert format_version(ScmVersion('1.0', distance=1, node='baadf00d'),
                          version_scheme='guess-next-dev',
                          local_scheme='node-date-and-build-number') == '1.1.dev1+baadf00d.b42'
Ejemplo n.º 4
0
def test_local_version2str():
    ver = ScmVersion('1.0', dirty=True, node='abcdef')
    ver_str = integration.local_version2str(ver)
    assert ver_str == '+abcdef.dirty'
    ver = ScmVersion('1.0', dirty=False)
    ver_str = integration.local_version2str(ver)
    assert ver_str == ''
    ver = ScmVersion('1.0', distance=1, dirty=True, node='abcdef')
    ver_str = integration.local_version2str(ver)
    assert ver_str == '+abcdef.dirty'
    ver = ScmVersion('1.0', distance=1, dirty=False, node='abcdef')
    ver_str = integration.local_version2str(ver)
    assert ver_str == '+abcdef'