summaryrefslogtreecommitdiff
path: root/testing/test_config.py
blob: 742605ea9f831f7bf31a185f94eac9b2afa71d2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from setuptools_scm.config import Configuration

import pytest


@pytest.mark.parametrize(
    "tag, expected_version",
    [
        ("apache-arrow-0.9.0", "0.9.0"),
        ("arrow-0.9.0", "0.9.0"),
        ("arrow-0.9.0-rc", "0.9.0-rc"),
        ("v1.1", "v1.1"),
        ("V1.1", "V1.1"),
    ],
)
def test_tag_regex(tag, expected_version):
    config = Configuration()
    match = config.tag_regex.match(tag)
    version = match.group("version")
    assert version == expected_version


def test_config_from_pyproject(tmpdir):
    fn = tmpdir / 'pyproject.toml'
    fn.write_text('[setuptools_scm]\nenabled = true\n', encoding='utf-8')
    config = Configuration.from_file(str(fn))
    assert config.enabled