14
0

- Add tests-with-sphinx-72.patch to fix tests with sphinx 7.2.

gh#sphinx-contrib/jquery#27

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-sphinxcontrib-jquery?expand=0&rev=5
This commit is contained in:
2023-09-04 12:09:33 +00:00
committed by Git OBS Bridge
parent 2a10bb29d0
commit 7acfdf425c
3 changed files with 52 additions and 17 deletions

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Sep 4 12:04:08 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- remove tests-with-sphinx-71.patch.
- Add tests-with-sphinx-72.patch to fix tests with sphinx 7.2.
gh#sphinx-contrib/jquery#27
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Sep 4 10:52:33 UTC 2023 - Dirk Müller <dmueller@suse.com> Mon Sep 4 10:52:33 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@@ -33,8 +33,8 @@ Summary: Extension to include jQuery on newer Sphinx releases
License: 0BSD License: 0BSD
URL: https://github.com/sphinx-contrib/jquery/ URL: https://github.com/sphinx-contrib/jquery/
Source: https://files.pythonhosted.org/packages/source/s/sphinxcontrib-jquery/sphinxcontrib-jquery-4.1.tar.gz Source: https://files.pythonhosted.org/packages/source/s/sphinxcontrib-jquery/sphinxcontrib-jquery-4.1.tar.gz
# Taken from https://github.com/sphinx-contrib/jquery/pull/26 # PATCH-FIX-UPSTREAM tests-with-sphinx-72.patch gh#sphinx-contrib/jquery#27
Patch1: tests-with-sphinx-71.patch Patch1: tests-with-sphinx-72.patch
BuildRequires: %{python_module flit-core} BuildRequires: %{python_module flit-core}
BuildRequires: %{python_module pip} BuildRequires: %{python_module pip}
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros

View File

@@ -1,17 +1,45 @@
From ac97ce5202b05ddb6bf4e5b77151a8964b6bf632 Mon Sep 17 00:00:00 2001 Index: sphinxcontrib-jquery-4.1/tests/test_jquery_installed.py
From: Dmitry Shachnev <mitya57@gmail.com> ===================================================================
Date: Mon, 31 Jul 2023 15:22:24 +0300 --- sphinxcontrib-jquery-4.1.orig/tests/test_jquery_installed.py
Subject: [PATCH] Make the tests pass with Sphinx 7.1 +++ sphinxcontrib-jquery-4.1/tests/test_jquery_installed.py
@@ -1,10 +1,9 @@
import base64
import hashlib
-from pathlib import Path
+from pathlib import Path, PosixPath
Fixes #25. import pytest
--- import sphinx
.github/workflows/test.yml | 5 ++++- -from sphinx.testing.path import path
tests/test_jquery_installed.py | 12 ++++++++---- from sphinx.testing.util import SphinxTestApp
2 files changed, 12 insertions(+), 5 deletions(-)
--- a/tests/test_jquery_installed.py from sphinxcontrib.jquery import _FILES, _ROOT_DIR # NoQA
+++ b/tests/test_jquery_installed.py @@ -23,12 +22,22 @@ def run_blank_app(srcdir, **kwargs):
@@ -38,12 +38,14 @@ def test_jquery_installed_sphinx_ge_60_use_sri(blank_app): return Path(srcdir, "_build", "html")
+class FakePath(PosixPath):
+ @classmethod
+ def _from_parts(cls, args, **kwargs):
+ cls._path = args[0]
+ return PosixPath._from_parts(args, **kwargs)
+
+ def resolve(self, *args, **kwargs):
+ return self._path
+
+
@pytest.fixture(scope="function")
def blank_app(tmpdir, monkeypatch):
def inner(**kwargs):
- return run_blank_app(path(tmpdir), **kwargs)
+ return run_blank_app(Path(tmpdir), **kwargs)
- monkeypatch.setattr("sphinx.application.abspath", lambda x: x)
+ monkeypatch.setattr("sphinx.application._StrPath", FakePath)
yield inner
@@ -38,12 +47,14 @@ def test_jquery_installed_sphinx_ge_60_u
out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"], "jquery_use_sri": True}) out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"], "jquery_use_sri": True})
text = out_dir.joinpath("index.html").read_text(encoding="utf-8") text = out_dir.joinpath("index.html").read_text(encoding="utf-8")
@@ -28,7 +56,7 @@ Fixes #25.
static_dir = out_dir / '_static' static_dir = out_dir / '_static'
assert static_dir.joinpath('jquery.js').is_file() assert static_dir.joinpath('jquery.js').is_file()
@@ -56,10 +58,12 @@ def test_jquery_installed_sphinx_ge_60(blank_app): @@ -56,10 +67,12 @@ def test_jquery_installed_sphinx_ge_60(b
out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"]}) out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"]})
text = out_dir.joinpath("index.html").read_text(encoding="utf-8") text = out_dir.joinpath("index.html").read_text(encoding="utf-8")