def test_initial_refresh_from_bad_git_path_env_warn(self, case):
        """In "w" mode, bad initial path sets "git" and warns, by logging."""
        (mode,) = case
        env_vars = {
            "GIT_PYTHON_GIT_EXECUTABLE": str(Path("yada").absolute()),  # Any bad path.
            "GIT_PYTHON_REFRESH": mode,
        }
        with _rollback_refresh():
            Git.GIT_PYTHON_GIT_EXECUTABLE = None  # Simulate startup.

            with mock.patch.dict(os.environ, env_vars):
                with self.assertLogs(cmd.__name__, logging.CRITICAL) as ctx:
                    refresh()
                self.assertEqual(len(ctx.records), 1)
                message = ctx.records[0].getMessage()
                self.assertRegex(message, r"\ABad git executable.\n")
                self.assertEqual(self.git.GIT_PYTHON_GIT_EXECUTABLE, "git")
In "w" mode, bad initial path sets "git" and warns, by logging.
test/test_git.py