Omit warning prefix in "Bad git executable" message by EliahKagan · Pull Request #1816 · gitpython-developers/GitPython

added 5 commits

February 6, 2024 01:01
Some tests in test_git.TestGit used type(self.git) while others
used Git. This changes them all to use Git. The distinction could
be relevant if self.git were set as a mock, but this is not being
done, and if it were, it is not obvious which would be preferred.
The intention of the existing tests is to test attributes of the
Git class, so this picks that simpler expression.
This changes test_initial_refresh_from_bad_git_path_env_warn to
assert a message with no added "WARNING:" prefix. As discussed
in gitpython-developers#1815, the extra prefix is confusing with logging configured,
showing "CRITICAL:git.cmd:WARNING: Bad git executable." instead of
"CRITICAL:git.cmd: Bad git executable."
As tested for in 3250313. This makes the test pass.
When logging with only a msg argument, it is a full literal message
rather than a format string (as it is when there are placeholders).
Thus both `...("%s", text)` and `...(text)`, where `...` is a
logging method or function, are equally good code styles, provided
`text` really is known to behave the same as `str(text)`.

The latter style, `...(text)`, was used in all logging calls, both
in the git module and in the test suite, except one. This changes
the one outlier from `...("%s", text)` to `...(text)` for stylistic
consistency and to avoid giving the false impression that there is
something special about that call.

lettuce-bot bot referenced this pull request in lettuce-financial/github-bot-signed-commit

Feb 15, 2024

renovate bot referenced this pull request in allenporter/flux-local

Feb 16, 2024