コード例 #1
0
def test_get_self_version_in_git_repo(
    monkeypatch,
    tmp_git_repo,  # pylint: disable=unused-argument
    git_cmd,
    git_commit_cmd,
    git_tag_cmd,
):
    """Check that get_self_version works properly in existing Git repo."""
    assert get_self_version() == '0.1.dev0'

    git_commit_cmd('-m', 'Test commit')
    git_tag_cmd('v1.3.9')
    assert get_self_version() == '1.3.9'

    git_commit_cmd('-m', 'Test commit 2')
    head_sha1_hash = git_cmd('rev-parse', '--short', 'HEAD').strip()
    assert get_self_version() == f'1.3.10.dev1+g{head_sha1_hash}'

    with monkeypatch.context() as mp_ctx:
        mp_ctx.setenv('PYPI_UPLOAD', 'true')
        assert get_self_version() == f'1.3.10.dev1'
コード例 #2
0
def test_get_self_version_outside_git_repo(
        temporary_working_directory,  # pylint: disable=unused-argument
):
    """Check that version is unknown outside of Git repo."""
    assert get_self_version() == 'unknown'
コード例 #3
0
def test_get_self_version_outside_git_repo(temporary_working_directory):
    """Check that version is unknown outside of Git repo."""
    assert get_self_version() == 'unknown'