File Fix-CI.patch of Package python-pygit2

From 51d35d010b9dcee199be5eb3785246ca9ef418e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= <jdavid.ibp@gmail.com>
Date: Thu, 21 Mar 2024 10:53:59 +0100
Subject: [PATCH] Fix CI

(cherry picked from commit 3eba911fb5fcc4d431d31848a66f117df8275af2)
---
 src/blob.c               |  1 +
 src/filter.c             |  1 +
 test/test_credentials.py | 10 ++++++----
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/blob.c b/src/blob.c
index e69a8f7..a1f40df 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -28,6 +28,7 @@
 #define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <git2.h>
+#include <git2/sys/errors.h>
 #include "diff.h"
 #include "error.h"
 #include "object.h"
diff --git a/src/filter.c b/src/filter.c
index a1b220e..5e51a20 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -28,6 +28,7 @@
 #define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <git2.h>
+#include <git2/sys/errors.h>
 #include <git2/sys/filter.h>
 #include "diff.h"
 #include "error.h"
diff --git a/test/test_credentials.py b/test/test_credentials.py
index 2d1166c..04e2185 100644
--- a/test/test_credentials.py
+++ b/test/test_credentials.py
@@ -26,6 +26,7 @@
 """Tests for credentials"""
 
 from pathlib import Path
+import platform
 
 import pytest
 
@@ -161,10 +162,11 @@ def test_fetch_certificate_check(testrepo):
         remote.fetch(callbacks=MyCallbacks())
 
     # libgit2 uses different error message for Linux and Windows
-    # TODO test one or the other depending on the platform
-    assert str(exc.value) in (
-        'user rejected certificate for github.com', # httpclient
-        'user cancelled certificate check') # winhttp
+    value = str(exc.value)
+    if platform.system() == 'Windows':
+        assert value == 'user cancelled certificate check'  # winhttp
+    else:
+        assert value == 'user rejected certificate for github.com'  # httpclient
 
     # TODO Add GitError.error_code
     #assert exc.value.error_code == pygit2.GIT_ERROR_HTTP
-- 
2.44.0

openSUSE Build Service is sponsored by