minor cleanups

This commit is contained in:
Manuel Barkhau 2020-12-06 22:53:40 +00:00
parent dd575bede7
commit ebd7534281
3 changed files with 15 additions and 36 deletions

View file

@ -35,11 +35,6 @@ Code Quality/CI:
[![Code Style: sjfmt][img_style]][url_style] [![Code Style: sjfmt][img_style]][url_style]
| Name | role | since | until |
|-------------------------------------|-------------------|---------|-------|
| Manuel Barkhau (mbarkhau@gmail.com) | author/maintainer | 2018-09 | - |
[img_github_build]: https://github.com/mbarkhau/pycalver/workflows/CI/badge.svg [img_github_build]: https://github.com/mbarkhau/pycalver/workflows/CI/badge.svg
[url_github_build]: https://github.com/mbarkhau/pycalver/actions?query=workflow%3ACI [url_github_build]: https://github.com/mbarkhau/pycalver/actions?query=workflow%3ACI
@ -395,7 +390,7 @@ PEP440 : 2020.1052
### Explicit `--set-version` ### Explicit `--set-version`
If the various automatic version incrementing methods don't work for you, you can explicitly do `--set-version=<version>`. If the various automatic version incrementing methods don't work for you, you can explicitly do `--set-version=<version>`.
```diff ```diff
$ bumpver update --dry --set-version="v2020.1060" $ bumpver update --dry --set-version="v2020.1060"
@ -1004,3 +999,9 @@ INFO - git commit --message 'bump version to 2020.1006'
INFO - git tag --annotate 2020.1006 --message 2020.1006 INFO - git tag --annotate 2020.1006 --message 2020.1006
INFO - git push origin --follow-tags 2020.1006 HEAD INFO - git push origin --follow-tags 2020.1006 HEAD
``` ```
## Contributors
| Name | role | since | until |
|-------------------------------------|-------------------|---------|-------|
| Manuel Barkhau (mbarkhau@gmail.com) | author/maintainer | 2018-09 | - |

View file

@ -241,7 +241,7 @@ def version_options(function: typ.Callable) -> typ.Callable:
@click.help_option() @click.help_option()
@verbose_option @verbose_option
def cli(verbose: int = 0) -> None: def cli(verbose: int = 0) -> None:
"""Automatically update CalVer version strings in plaintext files.""" """Automatically update version strings in plaintext files."""
if verbose: if verbose:
_configure_logging(verbose=max(_VERBOSE, verbose)) _configure_logging(verbose=max(_VERBOSE, verbose))

View file

@ -101,7 +101,6 @@ def runner(tmpdir):
def test_help(runner): def test_help(runner):
result = runner.invoke(cli.cli, ['--help', "-vv"]) result = runner.invoke(cli.cli, ['--help', "-vv"])
assert result.exit_code == 0 assert result.exit_code == 0
assert "CalVer" in result.output
assert "update " in result.output assert "update " in result.output
assert "test " in result.output assert "test " in result.output
assert "init " in result.output assert "init " in result.output
@ -927,32 +926,7 @@ README.* =
""" """
def test_multimatch_file_patterns_v1(runner): SETUP_CFG_MULTIMATCH_FILE_PATTERNS_FIXTURE_V2 = r"""
_add_project_files("README.md")
with pl.Path("setup.cfg").open(mode="w", encoding="utf-8") as fobj:
fobj.write(SETUP_CFG_MULTIMATCH_FILE_PATTERNS_FIXTURE_V1)
with pl.Path("README.md").open(mode="r", encoding="utf-8") as fobj:
content = fobj.read()
assert content.count("Hello World v201707.1002-alpha !") == 1
assert content.count("Hello World v202011.1003-beta !") == 0
assert content.count("[aka. 201707.1002a0 !]") == 1
assert content.count("[aka. 202011.1003b0 !]") == 0
result = runner.invoke(cli.cli, ['update', '--tag', 'beta', '--date', "2020-11-22"])
assert result.exit_code == 0
with pl.Path("README.md").open(mode="r", encoding="utf-8") as fobj:
content = fobj.read()
assert content.count("Hello World v201707.1002-alpha !") == 0
assert content.count("Hello World v202011.1003-beta !") == 1
assert content.count("[aka. 201707.1002a0 !]") == 0
assert content.count("[aka. 202011.1003b0 !]") == 1
SETUP_CFG_MULTIMATCH_FILE_PATTERNS_FIXTURE_v2 = r"""
[bumpver] [bumpver]
current_version = "v201701.1002-alpha" current_version = "v201701.1002-alpha"
version_pattern = "vYYYY0M.BUILD[-TAG][NUM]" version_pattern = "vYYYY0M.BUILD[-TAG][NUM]"
@ -967,10 +941,14 @@ README.* =
""" """
def test_multimatch_file_patterns_v2(runner): @pytest.mark.parametrize(
"config_text",
[SETUP_CFG_MULTIMATCH_FILE_PATTERNS_FIXTURE_V1, SETUP_CFG_MULTIMATCH_FILE_PATTERNS_FIXTURE_V2],
)
def test_multimatch_file_patterns(config_text, runner):
_add_project_files("README.md") _add_project_files("README.md")
with pl.Path("setup.cfg").open(mode="w", encoding="utf-8") as fobj: with pl.Path("setup.cfg").open(mode="w", encoding="utf-8") as fobj:
fobj.write(SETUP_CFG_MULTIMATCH_FILE_PATTERNS_FIXTURE_v2) fobj.write(config_text)
with pl.Path("README.md").open(mode="r", encoding="utf-8") as fobj: with pl.Path("README.md").open(mode="r", encoding="utf-8") as fobj:
content = fobj.read() content = fobj.read()