c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.06k stars 133 forks source link

test_usage_string fails #254

Open sebix opened 2 years ago

sebix commented 2 years ago

In our build environment for openSUSE packages, I get this test fail:

[    7s] ______________________________ test_usage_string _______________________________
[    7s] 
[    7s] tmpdir = local('/tmp/pytest-of-abuild/pytest-2/test_usage_string0')
[    7s] capsys = <_pytest.capture.CaptureFixture object at 0x7f58da848730>
[    7s] 
[    7s]     def test_usage_string(tmpdir, capsys):
[    7s]         tmpdir.chdir()
[    7s]     
[    7s]         with pytest.raises(SystemExit):
[    7s]             main(['--help'])
[    7s]     
[    7s]         out, err = capsys.readouterr()
[    7s]         assert err == ""
[    7s]     
[    7s]         for option_line in EXPECTED_OPTIONS:
[    7s]             assert option_line in out, "Usage string is missing {}".format(option_line)
[    7s]     
[    7s] >       assert EXPECTED_USAGE in out
[    7s] E       assert "bumpversion: v1.0.1 (using Python v3.10.5)\n\npositional arguments:\n  part                  Part of the version to be bumped.\n  file                  Files to change (default: [])\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --config-file FILE    Config file to read most of the variables from\n                        (default: .bumpversion.cfg)\n  --verbose             Print verbose logging to stderr (default: 0)\n  --list                List machine readable information (default: False)\n  --allow-dirty         Don't abort if working directory is dirty (default:\n                        False)\n  --parse REGEX         Regex parsing the version string (default:\n                        (?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+))\n  --serialize FORMAT    How to format what is parsed back to a version\n                        (default: ['{major}.{minor}.{patch}'])\n  --search SEARCH       Template for complete string to search (default:\n                        {current_version})\n  --replace REPLACE     Template for complete string to replace (default:\n                        {new_version})\n  --current-version VERSION\n          ...     Only replace the version in files specified on the\n                        command line, ignoring the files from the\n                        configuration file. (default: False)\n  --dry-run, -n         Don't write any files, just pretend. (default: False)\n  --new-version VERSION\n                        New version that should be in the files (default:\n                        None)\n  --commit              Commit to version control (default: False)\n  --no-commit           Do not commit to version control\n  --tag                 Create a tag in version control (default: False)\n  --no-tag              Do not create a tag in version control\n  --sign-tags           Sign tags if created (default: False)\n  --no-sign-tags        Do not sign tags if created\n  --tag-name TAG_NAME   Tag name (only works with --tag) (default:\n                        v{new_version})\n  --tag-message TAG_MESSAGE\n                        Tag message (default: Bump version: {current_version}\n                        → {new_version})\n  --message COMMIT_MSG, -m COMMIT_MSG\n                        Commit message (default: Bump version:\n                        {current_version} → {new_version})\n" in "usage: bumpversion [-h] [--config-file FILE] [--verbose] [--list]\n                   [--allow-dirty] [--parse REGEX] [--serialize FORMAT]\n                   [--search SEARCH] [--replace REPLACE]\n                   [--current-version VERSION] [--no-configured-files]\n                   [--dry-run] --new-version VERSION [--commit | --no-commit]\n                   [--tag | --no-tag] [--sign-tags | --no-sign-tags]\n                   [--tag-name TAG_NAME] [--tag-message TAG_MESSAGE]\n                   [--message COMMIT_MSG] [--commit-args COMMIT_ARGS]\n                   part [file ...]\n\nbumpversion: v1.0.1 (using Python v3.10.5)\n\npositional arguments:\n  part                  Part of the version to be bumped.\n  file                  Files to change (default: [])\n\noptions:\n  -h, --help            show this help message and exit\n  --config-file FILE    Config file to read most of the variables from\n                        (default: .bumpversion.cfg)\n  --verbose             Print verbose logging to stderr (default: 0)\n  --list                List machine readable information (default: False)\n  --allow-dirty         Don't abort if working directory is dirty (default:\...ing the files from the\n                        configuration file. (default: False)\n  --dry-run, -n         Don't write any files, just pretend. (default: False)\n  --new-version VERSION\n                        New version that should be in the files (default:\n                        None)\n  --commit              Commit to version control (default: False)\n  --no-commit           Do not commit to version control\n  --tag                 Create a tag in version control (default: False)\n  --no-tag              Do not create a tag in version control\n  --sign-tags           Sign tags if created (default: False)\n  --no-sign-tags        Do not sign tags if created\n  --tag-name TAG_NAME   Tag name (only works with --tag) (default:\n                        v{new_version})\n  --tag-message TAG_MESSAGE\n                        Tag message (default: Bump version: {current_version}\n                        → {new_version})\n  --message COMMIT_MSG, -m COMMIT_MSG\n                        Commit message (default: Bump version:\n                        {current_version} → {new_version})\n  --commit-args COMMIT_ARGS\n                        Extra arguments to commit command (default: )\n"
[    7s] 
[    7s] /home/abuild/rpmbuild/BUILD/bump2version-1.0.1/tests/test_cli.py:185: AssertionError
[    7s] =========================== short test summary info ============================

Using version 1.0.1 I already applied 1c4f04b6ab90f6d432b6c4117e0de38b006a5de5 to fix the test_usage_string test fail too.

yuzibo commented 1 year ago

I face the issue also:

>           assert option_line in out, "Usage string is missing {}".format(option_line)
E           AssertionError: Usage string is missing [file [file ...]]
E           assert '[file [file ...]]' in 'usage: bumpversion [-h] [--config-file FILE] [--verbose] [--list]\n                   [--allow-d
irty] [--parse REGEX]...→ {new_version})\n  --commit-args COMMIT_ARGS\n                        Extra arguments to commit command (default:
)\n'

/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11/build/tests/test_cli.py:183: AssertionError
...
>       assert "[file [file ...]]" in out
E       AssertionError: assert '[file [file ...]]' in 'usage: bumpversion [-h] [--config-file FILE] [--verbose] [--list]\n
  [--allow-dirty] [--parse REGEX]...→ {new_version})\n  --commit-args COMMIT_ARGS\n                        Extra arguments to commit comman
d (default: )\n'