Matej Cepl 2023-11-05 07:22:48 +00:00 committed by Git OBS Bridge
parent 8ae7f2b854
commit b37f0f9357
3 changed files with 38 additions and 5 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sun Nov 5 07:15:50 UTC 2023 - Matěj Cepl <mcepl@cepl.eu>
- Add skip-wcag-contrast-ratio.patch to make
python-wcag-contrast-ratio just optional dependency.
-------------------------------------------------------------------
Mon Aug 7 13:10:31 UTC 2023 - Benoît Monin <benoit.monin@gmx.fr>

View File

@ -32,18 +32,18 @@ License: BSD-2-Clause
Group: Development/Languages/Python
URL: https://pygments.org
Source: https://files.pythonhosted.org/packages/source/P/Pygments/Pygments-%{version}.tar.gz
# PATCH-FIX-UPSTREAM skip-wcag-contrast-ratio.patch bsc#[0-9]+ mcepl@suse.com
# Don't make wcag-contrast-ratio mandatory for testing
Patch0: skip-wcag-contrast-ratio.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest >= 7}
BuildRequires: %{python_module setuptools >= 61}
BuildRequires: %{python_module wcag-contrast-ratio}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros >= 20210929
# Preferred for plugin loading, see https://pygments.org/docs/plugins/
%if 0%{?python_version_nodots} < 38
Requires: python-importlib-metadata
%endif
Requires: (python-importlib-metadata if python-base < 3.8)
%if %{with libalternatives}
Requires: alts
BuildRequires: alts
@ -84,7 +84,6 @@ install -Dm0644 doc/pygmentize.1 %{buildroot}%{_mandir}/man1/pygmentize.1
}
%check
# skip test that requires wcag-contrast-ratio Python package
%pytest
%pre

View File

@ -0,0 +1,28 @@
---
tests/contrast/test_contrasts.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/tests/contrast/test_contrasts.py
+++ b/tests/contrast/test_contrasts.py
@@ -14,7 +14,11 @@ import os
import pygments.styles
import pygments.token
-import wcag_contrast_ratio
+try:
+ import wcag_contrast_ratio
+except ImportError:
+ wcag_contrast_ratio = None
+import unittest
JSON_FILENAME = os.path.join(os.path.dirname(__file__), "min_contrasts.json")
WCAG_AA_CONTRAST = 4.5
@@ -67,6 +71,8 @@ def update_json():
)
+@unittest.skipIf(wcag_contrast_ratio is None,
+ "wcag-contrast-ratio has not been installed")
def test_contrasts(fail_if_improved=True):
with open(JSON_FILENAME, encoding="utf-8") as f:
previous_contrasts = json.load(f)