mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 14:30:09 +01:00
test commit_message config
This commit is contained in:
parent
49e19fbf89
commit
4d08aea121
2 changed files with 58 additions and 19 deletions
|
|
@ -23,7 +23,7 @@ The recommended approach to using `pylint-ignore` is:
|
||||||
|
|
||||||
# Overview
|
# Overview
|
||||||
|
|
||||||
- [W0511: fixme (8x)](#w0511-fixme)
|
- [W0511: fixme (7x)](#w0511-fixme)
|
||||||
- [W0703: broad-except (1x)](#w0703-broad-except)
|
- [W0703: broad-except (1x)](#w0703-broad-except)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -129,20 +129,6 @@ The recommended approach to using `pylint-ignore` is:
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## File test/test_cli.py - Line 599 - W0511 (fixme)
|
|
||||||
|
|
||||||
- `message: # TODO (mb 2020-09-18):`
|
|
||||||
- `author : Manuel Barkhau <mbarkhau@gmail.com>`
|
|
||||||
- `date : 2020-09-18T19:35:32`
|
|
||||||
|
|
||||||
```
|
|
||||||
597:
|
|
||||||
598: # def test_custom_commit_message(runner):
|
|
||||||
> 599: # # TODO (mb 2020-09-18):
|
|
||||||
600: # assert False
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## File src/pycalver/v2version.py - Line 616 - W0511 (fixme)
|
## File src/pycalver/v2version.py - Line 616 - W0511 (fixme)
|
||||||
|
|
||||||
- `message: TODO (mb 2020-09-20): New Rollover Behaviour:`
|
- `message: TODO (mb 2020-09-20): New Rollover Behaviour:`
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import io
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
|
|
||||||
|
|
@ -209,7 +210,7 @@ def _update_config_val(filename, **kwargs):
|
||||||
|
|
||||||
new_cfg_text = old_cfg_text
|
new_cfg_text = old_cfg_text
|
||||||
for key, val in kwargs.items():
|
for key, val in kwargs.items():
|
||||||
replacement = "{} = {}\n".format(key, val)
|
replacement = "{} = {}".format(key, val)
|
||||||
if replacement not in new_cfg_text:
|
if replacement not in new_cfg_text:
|
||||||
pattern = r"^{} = .*$".format(key)
|
pattern = r"^{} = .*$".format(key)
|
||||||
new_cfg_text = re.sub(pattern, replacement, new_cfg_text, flags=re.MULTILINE)
|
new_cfg_text = re.sub(pattern, replacement, new_cfg_text, flags=re.MULTILINE)
|
||||||
|
|
@ -597,6 +598,58 @@ def test_v2_get_diff(runner):
|
||||||
assert '+current_version = "v202010.1003-beta"' in diff_lines
|
assert '+current_version = "v202010.1003-beta"' in diff_lines
|
||||||
|
|
||||||
|
|
||||||
# def test_custom_commit_message(runner):
|
def test_hg_commit_message(runner, caplog):
|
||||||
# # TODO (mb 2020-09-18):
|
_add_project_files("README.md", "setup.cfg")
|
||||||
# assert False
|
result = runner.invoke(cli, ['init', "-vv"])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
|
||||||
|
commit_message = """
|
||||||
|
"bump from {old_version} ({old_version_pep440}) to {new_version} ({new_version_pep440})"
|
||||||
|
"""
|
||||||
|
_update_config_val("setup.cfg", current_version='"v201903.1001-alpha"')
|
||||||
|
_update_config_val("setup.cfg", commit_message=commit_message.strip())
|
||||||
|
|
||||||
|
_vcs_init("hg", ["README.md", "setup.cfg"])
|
||||||
|
assert len(caplog.records) > 0
|
||||||
|
|
||||||
|
result = runner.invoke(cli, ['bump', "-vv", "--pin-date", "--release", "beta"])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
|
||||||
|
tags = shell("hg", "tags").decode("utf-8")
|
||||||
|
assert "v201903.1002-beta" in tags
|
||||||
|
|
||||||
|
commits = shell(*shlex.split("hg log -l 2")).decode("utf-8").split("\n\n")
|
||||||
|
|
||||||
|
summary = commits[1].split("summary:")[-1]
|
||||||
|
assert (
|
||||||
|
"bump from v201903.1001-alpha (201903.1001a0) to v201903.1002-beta (201903.1002b0)"
|
||||||
|
in summary
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_git_commit_message(runner, caplog):
|
||||||
|
_add_project_files("README.md", "setup.cfg")
|
||||||
|
result = runner.invoke(cli, ['init', "-vv"])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
|
||||||
|
commit_message = """
|
||||||
|
"bump: {old_version} ({old_version_pep440}) -> {new_version} ({new_version_pep440})"
|
||||||
|
"""
|
||||||
|
_update_config_val("setup.cfg", current_version='"v201903.1001-alpha"')
|
||||||
|
_update_config_val("setup.cfg", commit_message=commit_message.strip())
|
||||||
|
|
||||||
|
_vcs_init("git", ["README.md", "setup.cfg"])
|
||||||
|
assert len(caplog.records) > 0
|
||||||
|
|
||||||
|
result = runner.invoke(cli, ['bump', "-vv", "--pin-date", "--release", "beta"])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
|
||||||
|
tags = shell("git", "tag", "--list").decode("utf-8")
|
||||||
|
assert "v201903.1002-beta" in tags
|
||||||
|
|
||||||
|
commits = shell(*shlex.split("git log -l 2")).decode("utf-8").split("\n\n")
|
||||||
|
|
||||||
|
summary = commits[1]
|
||||||
|
assert (
|
||||||
|
"bump: v201903.1001-alpha (201903.1001a0) -> v201903.1002-beta (201903.1002b0)" in summary
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue