Other
-
Reject only directories as --config-file. 7506893
is_file() also rejected existing non-regular paths such as /dev/null, which worked before.
-
Reject a --config-file that is not a file. ec5fdab
resolve_conf_location()only checks that the path exists, so a directory is
accepted and handed to the config search, where reading it as TOML crashes:$ bump-my-version bump --config-file /tmp patch --dry-run Traceback (most recent call last): File ".../bumpversion/config/files.py", line 112, in _has_bumpversion_config return "bumpversion]" in path.read_text(encoding="utf-8") IsADirectoryError: [Errno 21] Is a directory: '/tmp'A path that does not exist is already reported along the same option:
$ bump-my-version bump --config-file /nope.toml patch --dry-run ; echo $? Error: '/nope.toml' does not exist.Change
resolve_conf_location()also rejects a path that is not a file, so both bad
inputs come out of the same place:$ bump-my-version bump --config-file /tmp patch --dry-run ; echo $? Error: '/tmp' is not a file. 2case before after --config-file <directory>IsADirectoryErrortraceback, exit 1'/tmp' is not a file., exit 2--config-file <missing>'...' does not exist.unchanged --config-file <valid file>loaded unchanged no --config-filesearch as before unchanged Tests
test_passing_directory_raises_errorintests/test_click_config.py.
pytest tests/test_click_config.pyhere: 7 passed / 3 failed with the change,
6 passed / 4 failed on the current tree — the difference is the new test; the
remaining 3 (test_*url*,test_download_url_success) fail on the current tree
too because the installedpytest-httpserverno longer hasserve_content.