Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heads-up: test failures with Python 3.13~alpha1 - indentation doesn't match the expected #279

Closed
befeleme opened this issue Nov 1, 2023 · 4 comments · Fixed by #281
Closed

Comments

@befeleme
Copy link

befeleme commented Nov 1, 2023

BUG/PROBLEM REPORT / FEATURE REQUEST

What I did:

In Fedora Linux, we're attempting to rebuild the system with the early Python 3.13 releases.
The test failure happens with Python 3.13~alpha1 during the RPM build.

In What's new in Python 3.13 there's:

Compiler now strip indents from docstrings. This will reduce the size of bytecode cache (e.g. .pyc file). For example, cache file size for sqlalchemy.orm.session in SQLAlchemy 2.0 is reduced by about 5%. This change will affect tools using docstrings, like doctest. (Contributed by Inada Naoki in gh-81283.)

What I expect to happen:

Successful build

What actually happened:

+ python3 -m unittest discover -s zope/interface -t .
................................s......................s.........................................................ss.....s.............s.s..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F..........F....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
======================================================================
FAIL: test_asReStructuredText_empty_with_multiline_docstring (zope.interface.tests.test_document.Test_asReStructuredText.test_asReStructuredText_empty_with_multiline_docstring)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-zope-interface-6.0-2.fc40.x86_64/usr/lib64/python3.13/site-packages/zope/interface/tests/test_document.py", line 298, in test_asReStructuredText_empty_with_multiline_docstring
    self.assertEqual(self._callFUT(IEmpty), EXPECTED)
AssertionError: '``IE[39 chars]n \n It can be used to annotate any class or o[66 chars]\n\n' != '``IE[39 chars]n \n             It can be used to annotate an[90 chars]\n\n'
  ``IEmpty``
  
   This is an empty interface.
   
-  It can be used to annotate any class or object, because it promises
+              It can be used to annotate any class or object, because it promises
? ++++++++++++
-  nothing.
+              nothing.
  
   Attributes:
  
   Methods:
======================================================================
FAIL: test_asStructuredText_empty_with_multiline_docstring (zope.interface.tests.test_document.Test_asStructuredText.test_asStructuredText_empty_with_multiline_docstring)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-zope-interface-6.0-2.fc40.x86_64/usr/lib64/python3.13/site-packages/zope/interface/tests/test_document.py", line 74, in test_asStructuredText_empty_with_multiline_docstring
    self.assertEqual(self._callFUT(IEmpty), EXPECTED)
AssertionError: 'IEmp[35 chars]n \n It can be used to annotate any class or o[66 chars]\n\n' != 'IEmp[35 chars]n \n             It can be used to annotate an[90 chars]\n\n'
  IEmpty
  
   This is an empty interface.
   
-  It can be used to annotate any class or object, because it promises
+              It can be used to annotate any class or object, because it promises
? ++++++++++++
-  nothing.
+              nothing.
  
   Attributes:
  
   Methods:

----------------------------------------------------------------------
Ran 1355 tests in 0.391s

FAILED (failures=2, skipped=7)
@icemac
Copy link
Member

icemac commented Dec 15, 2023

Thank you for reporting this issue, I'll activate Python 3.13 in GitHub actions to see if it comes this far.

@icemac
Copy link
Member

icemac commented Dec 15, 2023

This seems currently to be blocked by python-cffi/cffi#23, so we'll probably will not get to a test run at all.

@frenzymadness
Copy link
Contributor

Should the test for Python 3.13+ simply check the docstring without the indentation? Or is there any hidden meaning? I can prepare a PR and test it on Fedora.

@icemac
Copy link
Member

icemac commented Dec 18, 2023

The function under test converts the docstring to (re-)structured text. So the test for 3.13+ can just leave out the indentation.

frenzymadness added a commit to frenzymadness/zope.interface that referenced this issue Dec 18, 2023
In Python 3.13, compiler strips indents from docstrings.
See python/cpython#81283

Fixes: zopefoundation#279
frenzymadness added a commit to frenzymadness/zope.interface that referenced this issue Dec 18, 2023
In Python 3.13, compiler strips indents from docstrings.
See python/cpython#81283

Fixes: zopefoundation#279
icemac pushed a commit that referenced this issue Dec 20, 2023
In Python 3.13, compiler strips indents from docstrings.
See python/cpython#81283

Fixes: #279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants