Bug 2353140 - pytest fails to build with Python 3.14: mismatch of expected and actual strings in test output
Summary: pytest fails to build with Python 3.14: mismatch of expected and actual strin...
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: pytest
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-03-18 11:10 UTC by Karolina Surma
Modified: 2025-03-18 12:42 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github pytest-dev pytest issues 13308 0 None open Test failures with Python 3.14.0a6 2025-03-18 11:45:35 UTC

Description Karolina Surma 2025-03-18 11:10:56 UTC
pytest fails to build with Python 3.14.0a6.

6 test failures in pytest:
- pytest expects '* PytestUnraisableExceptionWarning: Exception ignored in: <function BrokenDel.__del__ at *>'
- the string from Python doesn't match: 'PytestUnraisableExceptionWarning: Exception ignored while calling deallocator <function BrokenDel.__del__ at 0x7f03f7859c70>: None'

_________________________ test_unraisable_in_teardown __________________________
[gw2] linux -- Python 3.14.0 /usr/bin/python3

pytester = <Pytester PosixPath('/tmp/pytest-of-mockbuild/pytest-0/popen-gw2/test_unraisable_in_teardown0')>

    @pytest.mark.skipif(PYPY, reason="garbage-collection differences make this flaky")
    @pytest.mark.filterwarnings("default::pytest.PytestUnraisableExceptionWarning")
    def test_unraisable_in_teardown(pytester: Pytester) -> None:
        pytester.makepyfile(
            test_it="""
            import pytest
    
            class BrokenDel:
                def __del__(self):
                    raise ValueError("del is broken")
    
            @pytest.fixture
            def broken_del():
                yield
                obj = BrokenDel()
                del obj
    
            def test_it(broken_del): pass
            def test_2(): pass
            """
        )
        result = pytester.runpytest()
        assert result.ret == 0
        assert result.parseoutcomes() == {"passed": 2, "warnings": 1}
>       result.stdout.fnmatch_lines(
            [
                "*= warnings summary =*",
                "test_it.py::test_it",
                "  * PytestUnraisableExceptionWarning: Exception ignored in: <function BrokenDel.__del__ at *>",
                "  ",
                "  Traceback (most recent call last):",
                "  ValueError: del is broken",
                "  ",
                "    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))",
            ]
        )
E       Failed: nomatch: '*= warnings summary =*'
E           and: '============================= test session starts =============================='
E           and: 'platform linux -- Python 3.14.0a6, pytest-8.3.5, pluggy-1.5.0'
E           and: 'rootdir: /tmp/pytest-of-mockbuild/pytest-0/popen-gw2/test_unraisable_in_teardown0'
E           and: 'collected 2 items'
E           and: ''
E           and: 'test_it.py ..                                                            [100%]'
E           and: ''
E       fnmatch: '*= warnings summary =*'
E          with: '=============================== warnings summary ==============================='
E       exact match: 'test_it.py::test_it'
E       nomatch: '  * PytestUnraisableExceptionWarning: Exception ignored in: <function BrokenDel.__del__ at *>'
E           and: '  /builddir/build/BUILD/pytest-8.3.5-build/BUILDROOT/usr/lib/python3.14/site-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning: Exception ignored while calling deallocator <function BrokenDel.__del__ at 0x7f03f7859c70>: None'
E           and: '  '
E           and: '  Traceback (most recent call last):'
E           and: '    File "/tmp/pytest-of-mockbuild/pytest-0/popen-gw2/test_unraisable_in_teardown0/test_it.py", line 5, in __del__'
E           and: '      raise ValueError("del is broken")'
E           and: '  ValueError: del is broken'
E           and: '  '
E           and: '    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))'
E           and: ''
E           and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E           and: '========================= 2 passed, 1 warning in 0.00s ========================='
E       remains unmatched: '  * PytestUnraisableExceptionWarning: Exception ignored in: <function BrokenDel.__del__ at *>'

/builddir/build/BUILD/pytest-8.3.5-build/pytest-8.3.5/testing/test_unraisableexception.py:106: Failed

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08783332-pytest/

For all our attempts to build pytest with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/pytest/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2025-03-18 11:45:36 UTC
Reported upstream https://github.com/pytest-dev/pytest/issues/13308


Note You need to log in before you can comment on or make changes to this bug.