def test_refresh_from_bad_absolute_git_path_env(self):
        """Bad absolute path from environment is reported and not set."""
        absolute_path = str(Path("yada").absolute())
        expected_pattern = rf"\n[ \t]*cmdline: {re.escape(absolute_path)}\Z"

        with _rollback_refresh() as old_git_executable:
            with mock.patch.dict(os.environ, {"GIT_PYTHON_GIT_EXECUTABLE": absolute_path}):
                with self.assertRaisesRegex(GitCommandNotFound, expected_pattern):
                    refresh()
                self.assertEqual(self.git.GIT_PYTHON_GIT_EXECUTABLE, old_git_executable)
Bad absolute path from environment is reported and not set.
test/test_git.py