Fix test_dark_style with python-pygments 2.16+
This commit is contained in:
parent
d3ad84c154
commit
5f7ebc734f
56
083d573b.patch
Normal file
56
083d573b.patch
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
From 083d573b7cf42d98f6c946715f52becba11d674b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Adam Turner <9087854+aa-turner@users.noreply.github.com>
|
||||||
|
Date: Mon, 7 Aug 2023 21:02:25 +0100
|
||||||
|
Subject: [PATCH] Fix ``test_dark_style`` for Pygments 2.16
|
||||||
|
|
||||||
|
---
|
||||||
|
tests/test_theming.py | 20 +++++++++++++++++---
|
||||||
|
1 file changed, 17 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_theming.py b/tests/test_theming.py
|
||||||
|
index 7473cb371c5..e3bd2a0f016 100644
|
||||||
|
--- a/tests/test_theming.py
|
||||||
|
+++ b/tests/test_theming.py
|
||||||
|
@@ -5,6 +5,7 @@
|
||||||
|
import alabaster
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
+import sphinx.builders.html
|
||||||
|
from sphinx.theming import ThemeError
|
||||||
|
|
||||||
|
|
||||||
|
@@ -91,18 +92,31 @@ def test_staticfiles(app, status, warning):
|
||||||
|
|
||||||
|
@pytest.mark.sphinx(testroot='theming',
|
||||||
|
confoverrides={'html_theme': 'test-theme'})
|
||||||
|
-def test_dark_style(app, status, warning):
|
||||||
|
+def test_dark_style(app, monkeypatch):
|
||||||
|
+ monkeypatch.setattr(sphinx.builders.html, '_file_checksum', lambda o, f: '')
|
||||||
|
+
|
||||||
|
style = app.builder.dark_highlighter.formatter_args.get('style')
|
||||||
|
assert style.__name__ == 'MonokaiStyle'
|
||||||
|
|
||||||
|
app.build()
|
||||||
|
assert (app.outdir / '_static' / 'pygments_dark.css').exists()
|
||||||
|
|
||||||
|
+ css_file, properties = app.registry.css_files[0]
|
||||||
|
+ assert css_file == 'pygments_dark.css'
|
||||||
|
+ assert "media" in properties
|
||||||
|
+ assert properties["media"] == '(prefers-color-scheme: dark)'
|
||||||
|
+
|
||||||
|
+ assert sorted(app.builder.css_files) == [
|
||||||
|
+ '_static/classic.css',
|
||||||
|
+ '_static/pygments.css',
|
||||||
|
+ '_static/pygments_dark.css',
|
||||||
|
+ ]
|
||||||
|
+
|
||||||
|
result = (app.outdir / 'index.html').read_text(encoding='utf8')
|
||||||
|
- assert '<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b76e3c8a" />' in result
|
||||||
|
+ assert '<link rel="stylesheet" type="text/css" href="_static/pygments.css" />' in result
|
||||||
|
assert ('<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" '
|
||||||
|
'rel="stylesheet" type="text/css" '
|
||||||
|
- 'href="_static/pygments_dark.css?v=e15ddae3" />') in result
|
||||||
|
+ 'href="_static/pygments_dark.css" />') in result
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx(testroot='theming')
|
@ -25,7 +25,7 @@ Name: python-sphinx
|
|||||||
#global prerel ...
|
#global prerel ...
|
||||||
%global upstream_version %{general_version}%{?prerel}
|
%global upstream_version %{general_version}%{?prerel}
|
||||||
Version: %{general_version}%{?prerel:~%{prerel}}
|
Version: %{general_version}%{?prerel:~%{prerel}}
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Summary: Python documentation generator
|
Summary: Python documentation generator
|
||||||
|
|
||||||
@ -43,6 +43,9 @@ Patch: sphinx-test_theming.diff
|
|||||||
# Fix test_assets_order for Sphinx 7.1.2
|
# Fix test_assets_order for Sphinx 7.1.2
|
||||||
Patch: https://github.com/sphinx-doc/sphinx/commit/85ffb3b0.patch
|
Patch: https://github.com/sphinx-doc/sphinx/commit/85ffb3b0.patch
|
||||||
|
|
||||||
|
# Fix test_dark_style with Pygments 2.16+
|
||||||
|
Patch: https://github.com/sphinx-doc/sphinx/commit/083d573b.patch
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
@ -364,6 +367,9 @@ mkdir %{buildroot}%{python3_sitelib}/sphinxcontrib
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Sep 21 2023 Karolina Surma <ksurma@redhat.com> - 1:7.1.2-2
|
||||||
|
- Fix FTBFS with Pygments 2.16+
|
||||||
|
|
||||||
* Mon Aug 14 2023 Karolina Surma <ksurma@redhat.com> - 1:7.1.2-1
|
* Mon Aug 14 2023 Karolina Surma <ksurma@redhat.com> - 1:7.1.2-1
|
||||||
- Update to 7.1.2
|
- Update to 7.1.2
|
||||||
- Fixes rhbz#2225274
|
- Fixes rhbz#2225274
|
||||||
|
Loading…
Reference in New Issue
Block a user