mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 22:40:09 +01:00
formatting for new style versions
This commit is contained in:
parent
f21c0f1d0f
commit
b07edc9c8a
12 changed files with 288 additions and 261 deletions
|
|
@ -66,7 +66,7 @@ setup.cfg =
|
|||
NEW_PATTERN_CFG_FIXTURE = """
|
||||
[pycalver]
|
||||
current_version = "v201808.1456-beta"
|
||||
version_pattern = "vYYYY0M.BUILD[-TAG]"
|
||||
version_pattern = "vYYYY0M.BUILD[-RELEASE]"
|
||||
commit_message = "bump version to {new_version}"
|
||||
commit = True
|
||||
tag = True
|
||||
|
|
@ -154,8 +154,8 @@ def test_parse_v2_cfg():
|
|||
assert "setup.py" in cfg.file_patterns
|
||||
assert "setup.cfg" in cfg.file_patterns
|
||||
# TODO (mb 2020-09-18):
|
||||
# assert cfg.file_patterns["setup.py" ] == ["vYYYY0M.BUILD[-TAG]", "YYYY0M.BLD[PYTAGNUM]"]
|
||||
# assert cfg.file_patterns["setup.cfg" ] == ['current_version = "vYYYY0M.BUILD[-TAG]"']
|
||||
# assert cfg.file_patterns["setup.py" ] == ["vYYYY0M.BUILD[-RELEASE]", "YYYY0M.BLD[PYTAGNUM]"]
|
||||
# assert cfg.file_patterns["setup.cfg" ] == ['current_version = "vYYYY0M.BUILD[-RELEASE]"']
|
||||
# assert cfg.file_patterns["src/project/*.py"] == ['Copyright (c) 2018-YYYY"']
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -129,25 +129,25 @@ V2_PART_PATTERN_CASES = [
|
|||
(['0V'], "53", "53"),
|
||||
(['0V'], "54", None),
|
||||
(['MAJOR', 'MINOR', 'PATCH'], "0", "0"),
|
||||
(['TAG' ], "alpha" , "alpha"),
|
||||
(['TAG' ], "alfa" , None),
|
||||
(['TAG' ], "beta" , "beta"),
|
||||
(['TAG' ], "dev" , "dev"),
|
||||
(['TAG' ], "rc" , "rc"),
|
||||
(['TAG' ], "post" , "post"),
|
||||
(['TAG' ], "final" , "final"),
|
||||
(['TAG' ], "latest", None),
|
||||
(['PYTAG'], "a" , "a"),
|
||||
(['PYTAG'], "b" , "b"),
|
||||
(['PYTAG'], "dev" , "dev"),
|
||||
(['PYTAG'], "rc" , "rc"),
|
||||
(['PYTAG'], "post" , "post"),
|
||||
(['PYTAG'], "post" , "post"),
|
||||
(['PYTAG'], "x" , None),
|
||||
(['NUM' ], "a" , None),
|
||||
(['NUM' ], "0" , "0"),
|
||||
(['NUM' ], "1" , "1"),
|
||||
(['NUM' ], "10" , "10"),
|
||||
(['RELEASE'], "alpha" , "alpha"),
|
||||
(['RELEASE'], "alfa" , None),
|
||||
(['RELEASE'], "beta" , "beta"),
|
||||
(['RELEASE'], "dev" , "dev"),
|
||||
(['RELEASE'], "rc" , "rc"),
|
||||
(['RELEASE'], "post" , "post"),
|
||||
(['RELEASE'], "final" , "final"),
|
||||
(['RELEASE'], "latest", None),
|
||||
(['PYTAG' ], "a" , "a"),
|
||||
(['PYTAG' ], "b" , "b"),
|
||||
(['PYTAG' ], "dev" , "dev"),
|
||||
(['PYTAG' ], "rc" , "rc"),
|
||||
(['PYTAG' ], "post" , "post"),
|
||||
(['PYTAG' ], "post" , "post"),
|
||||
(['PYTAG' ], "x" , None),
|
||||
(['NUM' ], "a" , None),
|
||||
(['NUM' ], "0" , "0"),
|
||||
(['NUM' ], "1" , "1"),
|
||||
(['NUM' ], "10" , "10"),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -141,8 +141,8 @@ def test_v1_optional_release():
|
|||
|
||||
def test_v2_optional_release():
|
||||
old_lines = OPTIONAL_RELEASE_FIXTURE.splitlines()
|
||||
pattern = "YYYY.BUILD[-TAG]"
|
||||
patterns = ['__version__ = "YYYY.BUILD[-TAG]"']
|
||||
pattern = "YYYY.BUILD[-RELEASE]"
|
||||
patterns = ['__version__ = "YYYY.BUILD[-RELEASE]"']
|
||||
|
||||
new_vinfo = v2version.parse_version_info("2019.0003", pattern)
|
||||
new_lines = v2rewrite.rewrite_lines(patterns, new_vinfo, old_lines)
|
||||
|
|
|
|||
|
|
@ -201,40 +201,29 @@ def test_v1_parse_versions(pattern_str, line, expected_vinfo):
|
|||
|
||||
# def test_v2_parse_versions(pattern_str, line, expected_vinfo):
|
||||
def test_v2_parse_versions():
|
||||
_vnfo = v2version.parse_version_info("v201712.0033", raw_pattern="vYYYY0M.BUILD[-TAG[NUM]]")
|
||||
_vnfo = v2version.parse_version_info("v201712.0033", raw_pattern="vYYYY0M.BUILD[-RELEASE[NUM]]")
|
||||
fvals = {'year_y': 2017, 'month': 12, 'bid': "0033"}
|
||||
assert _vnfo == v2version._parse_version_info(fvals)
|
||||
|
||||
|
||||
def test_make_segments():
|
||||
segs = v2version._make_segments("vYYYY0M.BUILD[-TAG[NUM]]")
|
||||
assert segs == ["vYYYY0M.BUILD", "-TAG", "NUM", "", ""]
|
||||
|
||||
segs = v2version._make_segments('__version__ = "YYYY0M.BLD[PYTAGNUM]"')
|
||||
assert segs == ['__version__ = "YYYY0M.BLD', 'PYTAGNUM', '"']
|
||||
|
||||
segs = v2version._make_segments('__version__ = "YYYY.BUILD[-TAG]"')
|
||||
assert segs == ['__version__ = "YYYY.BUILD', '-TAG', '"']
|
||||
|
||||
|
||||
def test_v2_format_version():
|
||||
version_pattern = "vYYYY0M.BUILD[-TAG[NUM]]"
|
||||
version_pattern = "vYYYY0M.BUILD[-RELEASE[NUM]]"
|
||||
in_version = "v200701.0033-beta"
|
||||
|
||||
vinfo = v2version.parse_version_info(in_version, raw_pattern=version_pattern)
|
||||
out_version = v2version.format_version(vinfo, raw_pattern=version_pattern)
|
||||
assert in_version == out_version
|
||||
|
||||
result = v2version.format_version(vinfo, raw_pattern="v0Y.BUILD[-TAG]")
|
||||
result = v2version.format_version(vinfo, raw_pattern="v0Y.BUILD[-RELEASE]")
|
||||
assert result == "v07.0033-beta"
|
||||
|
||||
result = v2version.format_version(vinfo, raw_pattern="vYY.BLD[-TAG]")
|
||||
result = v2version.format_version(vinfo, raw_pattern="vYY.BLD[-RELEASE]")
|
||||
assert result == "v7.33-beta"
|
||||
|
||||
result = v2version.format_version(vinfo, raw_pattern="vYY.BLD-TAG")
|
||||
result = v2version.format_version(vinfo, raw_pattern="vYY.BLD-RELEASE")
|
||||
assert result == "v7.33-beta"
|
||||
|
||||
result = v2version.format_version(vinfo, raw_pattern='__version__ = "YYYY.BUILD[-TAG]"')
|
||||
result = v2version.format_version(vinfo, raw_pattern='__version__ = "YYYY.BUILD[-RELEASE]"')
|
||||
assert result == '__version__ = "2007.0033-beta"'
|
||||
|
||||
result = v2version.format_version(vinfo, raw_pattern='__version__ = "YYYY.BLD"')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue