Skip to content

Don't suppress messages when logging is not configured #1813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't access logger in tests by nonpublic attribute
This changes a couple tests that access specific loggers to use the
logger name instead, as code outside GitPython should do.
  • Loading branch information
EliahKagan committed Jan 26, 2024
commit 78a82b3cf94e4c2fcaabd69a3f5a57e77ef1d26b
4 changes: 2 additions & 2 deletions test/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_it_uses_shell_or_not_as_specified(self, case):
def test_it_logs_if_it_uses_a_shell(self, case):
"""``shell=`` in the log message agrees with what is passed to `Popen`."""
value_in_call, value_from_class = case
with self.assertLogs(cmd._logger, level=logging.DEBUG) as log_watcher:
with self.assertLogs(cmd.__name__, level=logging.DEBUG) as log_watcher:
mock_safer_popen = self._do_shell_combo(value_in_call, value_from_class)
self._assert_logged_for_popen(log_watcher, "shell", mock_safer_popen.call_args.kwargs["shell"])

Expand All @@ -143,7 +143,7 @@ def test_it_logs_if_it_uses_a_shell(self, case):
)
def test_it_logs_istream_summary_for_stdin(self, case):
expected_summary, istream_argument = case
with self.assertLogs(cmd._logger, level=logging.DEBUG) as log_watcher:
with self.assertLogs(cmd.__name__, level=logging.DEBUG) as log_watcher:
self.git.execute(["git", "version"], istream=istream_argument)
self._assert_logged_for_popen(log_watcher, "stdin", expected_summary)

Expand Down