Accepting request 1003716 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1003716
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cairocffi?expand=0&rev=22
This commit is contained in:
Dominique Leuenberger 2022-09-21 12:39:56 +00:00 committed by Git OBS Bridge
commit 441e3be171
4 changed files with 135 additions and 1 deletions

View File

@ -0,0 +1,41 @@
diff --git a/setup.cfg b/setup.cfg
index 6ab6258..5ff9032 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -36,15 +36,11 @@ project_urls =
packages = find:
setup_requires =
cffi >= 1.1.0
- pytest-runner
setuptools
install_requires =
cffi >= 1.1.0
tests_require =
- pytest-cov
- pytest-flake8
- pytest-isort
- pytest-runner
+ pytest
numpy
python_requires = >= 3.7
@@ -59,10 +55,7 @@ doc =
sphinx
sphinx_rtd_theme
test =
- pytest-runner
- pytest-cov
- pytest-flake8
- pytest-isort
+ pytest
xcb =
xcffib >= 0.3.2
@@ -74,7 +67,6 @@ build-dir = docs/_build
test = pytest
[tool:pytest]
-addopts = --flake8 --isort
norecursedirs = build dist .cache .eggs .git
[flake8]

View File

@ -0,0 +1,80 @@
diff --git a/cairocffi/test_cairo.py b/cairocffi/test_cairo.py
index 867c9cf..e086415 100644
--- a/cairocffi/test_cairo.py
+++ b/cairocffi/test_cairo.py
@@ -236,8 +236,8 @@ def test_device_scale():
assert surface.get_device_scale() == (2, 3)
-@pytest.mark.xfail(cairo_version() < 11504,
- reason='Cairo version too low')
+@pytest.mark.xfail(not (11504 <= cairo_version() < 11706),
+ reason='Cairo version too bad')
def test_metadata():
file_obj = io.BytesIO()
surface = PDFSurface(file_obj, 1, 1)
@@ -261,8 +261,8 @@ def test_metadata():
assert b'/ModDate (20130721234600Z)' in pdf_bytes
-@pytest.mark.xfail(cairo_version() < 11504,
- reason='Cairo version too low')
+@pytest.mark.xfail(not (11504 <= cairo_version() < 11706),
+ reason='Cairo version too bad')
def test_outline():
file_obj = io.BytesIO()
surface = PDFSurface(file_obj, 1, 1)
@@ -276,8 +276,8 @@ def test_outline():
assert b'/Title (title 2)' in pdf_bytes
-@pytest.mark.xfail(cairo_version() < 11504,
- reason='Cairo version too low')
+@pytest.mark.xfail(not (11504 <= cairo_version() < 11706),
+ reason='Cairo version too bad')
def test_page_label():
file_obj = io.BytesIO()
surface = PDFSurface(file_obj, 1, 1)
@@ -287,8 +287,8 @@ def test_page_label():
assert b'/P (abc)' in pdf_bytes
-@pytest.mark.xfail(cairo_version() < 11504,
- reason='Cairo version too low')
+@pytest.mark.xfail(not (11504 <= cairo_version() < 11706),
+ reason='Cairo version too bad')
def test_tag():
file_obj = io.BytesIO()
surface = PDFSurface(file_obj, 10, 10)
@@ -327,8 +327,8 @@ def test_thumbnail_size():
assert len(pdf_bytes1) < len(pdf_bytes2)
-@pytest.mark.xfail(cairo_version() < 11510,
- reason='Cairo version too low')
+@pytest.mark.xfail(not (11510 <= cairo_version() < 11706),
+ reason='Cairo version too bad')
def test_document_unit():
surface = SVGSurface(None, 1, 2)
assert surface.get_document_unit() == SVG_UNIT_PT
@@ -395,8 +395,8 @@ def test_png():
surface = ImageSurface.create_from_png(io.BytesIO(b''))
-@pytest.mark.xfail(cairo_version() < 11000,
- reason='Cairo version too low')
+@pytest.mark.xfail(not (11000 <= cairo_version() < 11706),
+ reason='Cairo version too bad')
def test_pdf_versions():
assert set(PDFSurface.get_versions()) >= set([
cairocffi.PDF_VERSION_1_4, cairocffi.PDF_VERSION_1_5])
@@ -417,6 +417,8 @@ def test_pdf_versions():
assert file_obj.getvalue().startswith(b'%PDF-1.4')
+@pytest.mark.xfail(not (cairo_version() < 11706),
+ reason='Cairo version too bad')
def test_pdf_surface():
with temp_directory() as tempdir:
filename = os.path.join(tempdir, 'foo.pdf')

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Sep 13 15:56:49 UTC 2022 - Bjørn Lie <bjorn.lie@gmail.com>
- Add python-cairocffi-xfail.patch: Xfail some tests failing with
cairo 1.17.6.
- Add python-cairocffi-disable-linters.patch: Drop linters that
fail with new cairo.
-------------------------------------------------------------------
Sat Aug 20 21:23:34 UTC 2022 - Matej Cepl <mcepl@suse.com>

View File

@ -24,6 +24,11 @@ License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/Kozea/cairocffi
Source: https://files.pythonhosted.org/packages/source/c/cairocffi/cairocffi-%{version}.tar.gz
# PATCH-FIX-UPSTREAM python-cairocffi-xfail.patch -- Xfail some tests failing with cairo 1.17.6
Patch: python-cairocffi-xfail.patch
# PATCH-FIX-OPENSUSE python-cairocffi-disable-linters.patch -- Disable linters tests
Patch2: python-cairocffi-disable-linters.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module cffi >= 1.1.0}
BuildRequires: %{python_module setuptools >= 39.2.0}
@ -65,7 +70,7 @@ including image buffers, PNG, PostScript, PDF, and SVG file output.
This package provides the optional gdk-pixbuf image loader module.
%prep
%setup -q -n cairocffi-%{version}
%autosetup -n cairocffi-%{version} -p1
# disable development tools for unit tests. Remove deprecated pytest-runner
sed -i -e 's/pytest-runner$/pytest/' \
-e '/pytest-flake8$/ d' \