#10 Make test_document compatible with Python 3.13
Merged 5 months ago by lbalhar. Opened 5 months ago by ksurma.
rpms/ ksurma/python-zope-interface py3.13  into  rawhide

file added
+65
@@ -0,0 +1,65 @@ 

+ From c97078652590b916830afd156a5269dfe5f54e40 Mon Sep 17 00:00:00 2001

+ From: Lumir Balhar <lbalhar@redhat.com>

+ Date: Mon, 18 Dec 2023 13:46:06 +0100

+ Subject: [PATCH] Make test_document compatible with Python 3.13

+ 

+ In Python 3.13, compiler strips indents from docstrings.

+ See https://github.com/python/cpython/issues/81283

+ 

+ Fixes: https://github.com/zopefoundation/zope.interface/issues/279

+ ---

+  src/zope/interface/tests/test_document.py | 15 +++++++++++----

+  1 file changed, 11 insertions(+), 4 deletions(-)

+ 

+ diff --git a/src/zope/interface/tests/test_document.py b/src/zope/interface/tests/test_document.py

+ index 3e6dddd8..f00e6311 100644

+ --- a/src/zope/interface/tests/test_document.py

+ +++ b/src/zope/interface/tests/test_document.py

+ @@ -13,6 +13,7 @@

+  ##############################################################################

+  """Documentation tests.

+  """

+ +import sys

+  import unittest

+  

+  

+ @@ -50,14 +51,17 @@ class IEmpty(Interface):

+  

+      def test_asStructuredText_empty_with_multiline_docstring(self):

+          from zope.interface import Interface

+ +        # In Python 3.13+, compiler strips indents from docstrings

+ +        indent = " " * 12 if sys.version_info < (3, 13) else ""

+ +

+          EXPECTED = '\n'.join([

+              "IEmpty",

+              "",

+              " This is an empty interface.",

+              " ",

+ -            ("             It can be used to annotate any class or object, "

+ +            (f"{indent} It can be used to annotate any class or object, "

+                               "because it promises"),

+ -            "             nothing.",

+ +            f"{indent} nothing.",

+              "",

+              " Attributes:",

+              "",

+ @@ -274,14 +278,17 @@ class IEmpty(Interface):

+  

+      def test_asReStructuredText_empty_with_multiline_docstring(self):

+          from zope.interface import Interface

+ +        # In Python 3.13+, compiler strips indents from docstrings

+ +        indent = " " * 12 if sys.version_info < (3, 13) else ""

+ +

+          EXPECTED = '\n'.join([

+              "``IEmpty``",

+              "",

+              " This is an empty interface.",

+              " ",

+ -            ("             It can be used to annotate any class or object, "

+ +            (f"{indent} It can be used to annotate any class or object, "

+                               "because it promises"),

+ -            "             nothing.",

+ +            f"{indent} nothing.",

+              "",

+              " Attributes:",

+              "",

file modified
+4 -1
@@ -13,6 +13,9 @@ 

  URL:		https://pypi.io/project/zope.interface

  Source0:	https://pypi.io/packages/source/z/zope.interface/zope.interface-%{version}.tar.gz

  

+ # Make test_document compatible with Python 3.13

+ Patch:          https://github.com/zopefoundation/zope.interface/pull/281.patch

+ 

  %description

  Interfaces are a mechanism for labeling objects as conforming to a given API

  or contract.
@@ -44,7 +47,7 @@ 

  %endif

  

  %prep

- %autosetup -n zope.interface-%{version}

+ %autosetup -n zope.interface-%{version} -p1

  

  # Update the sphinx theme name

  sed -i "s/'default'/'classic'/" docs/conf.py

I verified this builds with Python 3.13 successfully.

Looks good to me, thank you. Merging without a build.

Pull-Request has been merged by lbalhar

5 months ago

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/94e32e4ef3db41daa65953a17604394a

Metadata