Bug 2479754

Summary: python-icalendar fails to build with Python 3.15: test failures related to the changed pprint output
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-icalendarAssignee: Gwyn Ciesla <gwync>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: gwync, ksurma, mhroncok
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2026-05-25 12:25:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2412434    

Description Karolina Surma 2026-05-19 08:36:25 UTC
python-icalendar fails to build with Python 3.15.0b1.

____________ test_docstring_of_python_file[icalendar.cal.component] ____________

module_name = 'icalendar.cal.component'
env_for_doctest = {'print': <function doctest_print at 0x7f3feac6afb0>}

    @pytest.mark.parametrize("module_name", MODULE_NAMES)
    def test_docstring_of_python_file(module_name: str, env_for_doctest) -> None:
        """This test runs doctest on the Python module."""
        try:
            module = importlib.import_module(module_name)
        except ModuleNotFoundError as e:
            if e.name == "pytz":
                pytest.skip("pytz is not installed, skipping this module.")
            raise
        test_result = doctest.testmod(module, name=module_name, globs=env_for_doctest)
>       assert test_result.failed == 0, f"{test_result.failed} errors in {module_name}"
E       AssertionError: 1 errors in icalendar.cal.component
E       assert 1 == 0
E        +  where 1 = TestResults(failed=1, attempted=43).failed

src/icalendar/tests/test_with_doctest.py:53: AssertionError
----------------------------- Captured stdout call -----------------------------
**********************************************************************
File "/builddir/build/BUILD/python-icalendar-7.1.0-build/python3-python-icalendar-7.1.0-1.fc45/src/icalendar/cal/component.py", line 799, in icalendar.cal.component.Component.to_jcal
Failed example:
    pprint(event.to_jcal())
Expected:
    ['vevent',
     [['dtstamp', {}, 'date-time', '2025-05-17T08:06:12Z'],
      ['summary', {}, 'text', 'My Event'],
      ['uid', {}, 'text', 'd755cef5-2311-46ed-a0e1-6733c9e15c63'],
      ['dtstart', {}, 'date', '2025-11-22']],
     []]
Got:
    [
        'vevent',
        [
            ['dtstamp', {}, 'date-time', '2025-05-17T08:06:12Z'],
            ['summary', {}, 'text', 'My Event'],
            ['uid', {}, 'text', 'd755cef5-2311-46ed-a0e1-6733c9e15c63'],
            ['dtstart', {}, 'date', '2025-11-22'],
        ],
        [],
    ]
**********************************************************************
1 item had failures:
   1 of   5 in icalendar.cal.component.Component.to_jcal
***Test Failed*** 1 failure.
_________________ test_documentation_file[zoneinfo-document14] _________________

document = PosixPath('/builddir/build/BUILD/python-icalendar-7.1.0-build/python3-python-icalendar-7.1.0-1.fc45/docs/how-to/jcal.rst')
zoneinfo_only = 'zoneinfo'
env_for_doctest = {'print': <function doctest_print at 0x7f3feac6afb0>}
tzp = TZP('zoneinfo')

    @pytest.mark.parametrize("document", DOCUMENT_PATHS)
    def test_documentation_file(document, zoneinfo_only, env_for_doctest, tzp):
        """This test runs doctest on a documentation file.
    
        functions are also replaced to work.
        """
        try:
            import pytz  # noqa: F401
        except ImportError:
            pytest.skip("pytz not installed, skipping this file.")
        try:
            # set raise_on_error to False if you wand to see the error for debug
            test_result = doctest.testfile(
                document, module_relative=False, globs=env_for_doctest, raise_on_error=False
            )
        finally:
            tzp.use_zoneinfo()
>       assert test_result.failed == 0, (
            f"{test_result.failed} errors in {Path(document).name}"
        )
E       AssertionError: 1 errors in jcal.rst
E       assert 1 == 0
E        +  where 1 = TestResults(failed=1, attempted=10).failed

src/icalendar/tests/test_with_doctest.py:89: AssertionError
----------------------------- Captured stdout call -----------------------------
**********************************************************************
File "/builddir/build/BUILD/python-icalendar-7.1.0-build/python3-python-icalendar-7.1.0-1.fc45/docs/how-to/jcal.rst", line 63, in jcal.rst
Failed example:
    pprint(calendar.to_jcal())
Expected:
    ['vcalendar',
     [['calscale', {}, 'text', 'GREGORIAN'],
      ['prodid', {}, 'text', '-//Example Inc.//Example Calendar//EN'],
      ['version', {}, 'text', '2.0']],
     [['vevent',
       [['dtstamp', {}, 'date-time', '2008-02-05T19:12:24Z'],
        ['dtstart', {}, 'date', '2008-10-06'],
        ['summary', {}, 'text', 'Planning meeting'],
        ['uid', {}, 'text', '4088E990AD89CB3DBB484909']],
       []]]]
Got:
    [
        'vcalendar',
        [
            ['calscale', {}, 'text', 'GREGORIAN'],
            ['prodid', {}, 'text', '-//Example Inc.//Example Calendar//EN'],
            ['version', {}, 'text', '2.0'],
        ],
        [
            [
                'vevent',
                [
                    ['dtstamp', {}, 'date-time', '2008-02-05T19:12:24Z'],
                    ['dtstart', {}, 'date', '2008-10-06'],
                    ['summary', {}, 'text', 'Planning meeting'],
                    ['uid', {}, 'text', '4088E990AD89CB3DBB484909'],
                ],
                [],
            ],
        ],
    ]
**********************************************************************
1 item had failures:
   1 of  10 in jcal.rst
***Test Failed*** 1 failure.
=========================== short test summary info ============================
FAILED src/icalendar/tests/test_with_doctest.py::test_docstring_of_python_file[icalendar.cal.component]
FAILED src/icalendar/tests/test_with_doctest.py::test_documentation_file[zoneinfo-document14]
================= 2 failed, 14709 passed, 28 skipped in 54.05s =================

https://docs.python.org/3.15/whatsnew/3.15.html:
pprint now uses modern defaults: indent=4, width=88, and the default compact=False output is now formatted similar to pretty-printed json.dumps(). (Contributed by Stefan Todoran, Semyon Moroz and Hugo van Kemenade in gh-112632 and gh-149189.)

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.15-b1/fedora-rawhide-x86_64/10477926-python-icalendar/

For all our attempts to build python-icalendar with Python 3.15, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15-b1/package/python-icalendar/

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.15:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15-b1/

Let us know here if you have any questions.

Python 3.15 is planned to be included in Fedora 45.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.15.
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 Karolina Surma 2026-05-25 08:16:38 UTC
This will be reverted in beta2: https://github.com/python/cpython/pull/150249 - I'll close the issue once verified.