File tests-with-sphinx-72-python312.patch of Package python-sphinxcontrib-jquery

From ac97ce5202b05ddb6bf4e5b77151a8964b6bf632 Mon Sep 17 00:00:00 2001
From: Dmitry Shachnev <mitya57@gmail.com>
Date: Mon, 31 Jul 2023 15:22:24 +0300
Subject: [PATCH 1/4] Make the tests pass with Sphinx 7.1

Fixes #25.
---
 .github/workflows/test.yml     |  5 ++++-
 tests/test_jquery_installed.py | 12 ++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

Index: sphinxcontrib-jquery-4.1/tests/test_jquery_installed.py
===================================================================
--- sphinxcontrib-jquery-4.1.orig/tests/test_jquery_installed.py
+++ sphinxcontrib-jquery-4.1/tests/test_jquery_installed.py
@@ -4,11 +4,15 @@ from pathlib import Path
 
 import pytest
 import sphinx
-from sphinx.testing.path import path
 from sphinx.testing.util import SphinxTestApp
 
 from sphinxcontrib.jquery import _FILES, _ROOT_DIR  # NoQA
 
+if sphinx.version_info[:2] >= (7, 2):
+    test_path = Path
+else:
+    from sphinx.testing.path import path as test_path
+
 
 def run_blank_app(srcdir, **kwargs):
     Path(srcdir, "conf.py").write_text("", encoding="ascii")
@@ -24,11 +28,13 @@ def run_blank_app(srcdir, **kwargs):
 
 
 @pytest.fixture(scope="function")
-def blank_app(tmpdir, monkeypatch):
+def blank_app(tmp_path, monkeypatch):
     def inner(**kwargs):
-        return run_blank_app(path(tmpdir), **kwargs)
+        return run_blank_app(test_path(tmp_path), **kwargs)
 
-    monkeypatch.setattr("sphinx.application.abspath", lambda x: x)
+    # Sphinx>=7.2 doesn't have abspath
+    if sphinx.version_info[:2] < (7, 2):
+        monkeypatch.setattr("sphinx.application.abspath", lambda x: x)
     yield inner
 
 
@@ -38,12 +44,14 @@ def test_jquery_installed_sphinx_ge_60_u
     out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"], "jquery_use_sri": True})
 
     text = out_dir.joinpath("index.html").read_text(encoding="utf-8")
+    checksum = '?v=5d32c60e' if sphinx.version_info[:2] >= (7, 1) else ''
     assert ('<script '
             'integrity="sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK" '
-            'src="_static/jquery.js"></script>') in text
+            f'src="_static/jquery.js{checksum}"></script>') in text
+    checksum = '?v=2cd50e6c' if sphinx.version_info[:2] >= (7, 1) else ''
     assert ('<script '
             'integrity="sha384-lSZeSIVKp9myfKbDQ3GkN/KHjUc+mzg17VKDN4Y2kUeBSJioB9QSM639vM9fuY//" '
-            'src="_static/_sphinx_javascript_frameworks_compat.js"></script>') in text
+            f'src="_static/_sphinx_javascript_frameworks_compat.js{checksum}"></script>') in text
 
     static_dir = out_dir / '_static'
     assert static_dir.joinpath('jquery.js').is_file()
@@ -56,10 +64,12 @@ def test_jquery_installed_sphinx_ge_60(b
     out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"]})
 
     text = out_dir.joinpath("index.html").read_text(encoding="utf-8")
+    checksum = '?v=5d32c60e' if sphinx.version_info[:2] >= (7, 1) else ''
     assert ('<script '
-            'src="_static/jquery.js"></script>') in text
+            f'src="_static/jquery.js{checksum}"></script>') in text
+    checksum = '?v=2cd50e6c' if sphinx.version_info[:2] >= (7, 1) else ''
     assert ('<script '
-            'src="_static/_sphinx_javascript_frameworks_compat.js"></script>') in text
+            f'src="_static/_sphinx_javascript_frameworks_compat.js{checksum}"></script>') in text
 
     static_dir = out_dir / '_static'
     assert static_dir.joinpath('jquery.js').is_file()
openSUSE Build Service is sponsored by