#5 Xfail some tests failing with cairo 1.17.6
Merged 2 months ago by fschwarz. Opened 2 months ago by churchyard.
rpms/ churchyard/python-cairocffi tests  into  rawhide

python-cairocffi-disable-linters.patch python-cairocffi-disable-flake8-isort-for-pytest.patch
file renamed
+19 -8
@@ -1,26 +1,37 @@ 

  diff --git a/setup.cfg b/setup.cfg

- index 6ab6258..27cd86e 100644

+ index 6ab6258..5ff9032 100644

  --- a/setup.cfg

  +++ b/setup.cfg

- @@ -42,8 +42,6 @@ install_requires =

+ @@ -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-cov

  -	pytest-flake8

  -	pytest-isort

-  	pytest-runner

+ -	pytest-runner

+ +	pytest

   	numpy

   python_requires = >= 3.7

- @@ -61,8 +59,6 @@ doc =

+  

+ @@ -59,10 +55,7 @@ doc =

+  	sphinx

+  	sphinx_rtd_theme

   test = 

-  	pytest-runner

-  	pytest-cov

+ -	pytest-runner

+ -	pytest-cov

  -	pytest-flake8

  -	pytest-isort

+ +	pytest

   xcb = 

   	xcffib >= 0.3.2

   

- @@ -74,7 +70,6 @@ build-dir = docs/_build

+ @@ -74,7 +67,6 @@ build-dir = docs/_build

   test = pytest

   

   [tool:pytest]

@@ -0,0 +1,79 @@ 

+ 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')

file modified
+9 -5
@@ -2,12 +2,13 @@ 

  

  Name:           python-cairocffi

  Version:        1.3.0

- Release:        2%{?dist}

+ Release:        3%{?dist}

  Summary:        cffi-based cairo bindings for Python

  License:        BSD

  URL:            https://pypi.python.org/pypi/cairocffi/

  Source0:        %{pypi_source}

- Patch0:         python-cairocffi-disable-flake8-isort-for-pytest.patch

+ Patch0:         python-cairocffi-disable-linters.patch

+ Patch1:         python-cairocffi-xfail.patch

  

  BuildArch:      noarch

  
@@ -15,8 +16,6 @@ 

  BuildRequires:  python3-setuptools

  BuildRequires:  python3-cffi >= 1.1.0

  BuildRequires:  python3-pytest

- BuildRequires:  python3-pytest-cov

- BuildRequires:  python3-pytest-runner

  BuildRequires:  python3-xcffib >= 0.3.2

  BuildRequires:  cairo-devel

  # required to run the test suite
@@ -59,7 +58,8 @@ 

  

  %check

  # test_xcb.py needs a display

- xvfb-run %{__python3} setup.py test

+ %global __pytest xvfb-run /usr/bin/pytest

+ %pytest -v --pyargs cairocffi

  

  

  %files -n python3-cairocffi
@@ -69,6 +69,10 @@ 

  %{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info/

  

  %changelog

+ * Mon Jun 06 2022 Miro Hrončok <mhroncok@redhat.com> - 1.3.0-3

+ - Drop some unneeded build time dependencies

+ - Xfail tests failing with cairo 1.17.6

+ 

  * Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-2

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

  

I am not very proud of this, but better than a complete failure :/

Thanks for the patch. May I add you as a maintainer so you can deal with potential fallout?

Pull-Request has been merged by fschwarz

2 months ago

I am not particularly interested in being the primary maintainer here, but this is within my dependency tree, unfortunately, so please do it :)

We should probably also add the SIG.

We should probably also add the SIG.

done. I'll unassign myself from the package so you are welcome to trigger the necessary builds...