mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 06:20:08 +01:00
more coverage
This commit is contained in:
parent
4598286f12
commit
df492a20d6
10 changed files with 128 additions and 27 deletions
|
|
@ -5,7 +5,7 @@ from pycalver import config
|
|||
from . import util
|
||||
|
||||
|
||||
PYCALVER_TOML_FIXTURE = """
|
||||
PYCALVER_TOML_FIXTURE_1 = """
|
||||
[pycalver]
|
||||
current_version = "v201808.0123-alpha"
|
||||
commit = true
|
||||
|
|
@ -23,6 +23,22 @@ push = true
|
|||
"""
|
||||
|
||||
|
||||
PYCALVER_TOML_FIXTURE_2 = """
|
||||
[pycalver]
|
||||
current_version = "1.2.3"
|
||||
version_pattern = "{semver}"
|
||||
|
||||
[pycalver.file_patterns]
|
||||
"README.md" = [
|
||||
"{version}",
|
||||
"{pep440_version}",
|
||||
]
|
||||
"pycalver.toml" = [
|
||||
'current_version = "{version}"',
|
||||
]
|
||||
"""
|
||||
|
||||
|
||||
SETUP_CFG_FIXTURE = """
|
||||
[pycalver]
|
||||
current_version = "v201808.0456-beta"
|
||||
|
|
@ -46,13 +62,14 @@ def mk_buf(text):
|
|||
return buf
|
||||
|
||||
|
||||
def test_parse_toml():
|
||||
buf = mk_buf(PYCALVER_TOML_FIXTURE)
|
||||
def test_parse_toml_1():
|
||||
buf = mk_buf(PYCALVER_TOML_FIXTURE_1)
|
||||
|
||||
raw_cfg = config._parse_toml(buf)
|
||||
cfg = config._parse_config(raw_cfg)
|
||||
|
||||
assert cfg.current_version == "v201808.0123-alpha"
|
||||
assert cfg.version_pattern == "{pycalver}"
|
||||
assert cfg.commit is True
|
||||
assert cfg.tag is True
|
||||
assert cfg.push is True
|
||||
|
|
@ -62,6 +79,23 @@ def test_parse_toml():
|
|||
assert cfg.file_patterns["pycalver.toml"] == ['current_version = "{pycalver}"']
|
||||
|
||||
|
||||
def test_parse_toml_2():
|
||||
buf = mk_buf(PYCALVER_TOML_FIXTURE_2)
|
||||
|
||||
raw_cfg = config._parse_toml(buf)
|
||||
cfg = config._parse_config(raw_cfg)
|
||||
|
||||
assert cfg.current_version == "1.2.3"
|
||||
assert cfg.version_pattern == "{semver}"
|
||||
assert cfg.commit is False
|
||||
assert cfg.tag is False
|
||||
assert cfg.push is False
|
||||
|
||||
assert "pycalver.toml" in cfg.file_patterns
|
||||
assert cfg.file_patterns["README.md" ] == ["{semver}", "{semver}"]
|
||||
assert cfg.file_patterns["pycalver.toml"] == ['current_version = "{semver}"']
|
||||
|
||||
|
||||
def test_parse_cfg():
|
||||
buf = mk_buf(SETUP_CFG_FIXTURE)
|
||||
|
||||
|
|
@ -154,7 +188,7 @@ def test_parse_project_cfg():
|
|||
def test_parse_toml_file(tmpdir):
|
||||
project_path = tmpdir.mkdir("minimal")
|
||||
setup_cfg = project_path.join("pycalver.toml")
|
||||
setup_cfg.write(PYCALVER_TOML_FIXTURE)
|
||||
setup_cfg.write(PYCALVER_TOML_FIXTURE_1)
|
||||
|
||||
ctx = config.init_project_ctx(project_path)
|
||||
assert ctx == config.ProjectContext(project_path, setup_cfg, 'toml', None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue