From 78a82b3cf94e4c2fcaabd69a3f5a57e77ef1d26b Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 26 Jan 2024 00:49:39 -0500 Subject: [PATCH] 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. --- test/test_git.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_git.py b/test/test_git.py index 546416691..116a9f5df 100644 --- a/test/test_git.py +++ b/test/test_git.py @@ -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"]) @@ -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)