Bug 2567355

Summary: python-pytest-subprocess fails to build with Python 3.16: The event loop policy system has been removed from Python 3.16
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-pytest-subprocessAssignee: Miro HronĨok <mhroncok>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fedora, ksurma, mhroncok, python-packagers-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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: 2567340    

Description Karolina Surma 2026-11-05 16:35:24 UTC
python-pytest-subprocess fails to build with Python 3.16.0a1.

_________________ ERROR at setup of test_process_recorder_args _________________

request = <SubRequest 'event_loop_policy' for <Coroutine test_process_recorder_args>>

    @pytest.fixture()
    def event_loop_policy(request):
        if sys.platform.startswith("win"):
            if request.node.name.startswith("test_invalid_event_loop"):
                return _windows_selector_event_loop_policy()
            return _windows_proactor_event_loop_policy()
    
>       return _default_event_loop_policy()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/test_asyncio.py:69: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def _default_event_loop_policy():
        """Return a platform default policy without deprecated asyncio aliases."""
        if sys.platform.startswith("win"):
            from asyncio import windows_events
    
            policy_cls = getattr(windows_events, "_DefaultEventLoopPolicy", None)
            if policy_cls is None:
                policy_cls = getattr(windows_events, "DefaultEventLoopPolicy")
            return policy_cls()
    
        from asyncio import unix_events
    
        policy_cls = getattr(unix_events, "_DefaultEventLoopPolicy", None)
        if policy_cls is None:
>           policy_cls = unix_events.DefaultEventLoopPolicy
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           AttributeError: module 'asyncio.unix_events' has no attribute 'DefaultEventLoopPolicy'

tests/test_asyncio.py:40: AttributeError
=================================== FAILURES ===================================
____________________________ test_check_call[True] _____________________________

fp = <pytest_subprocess.fake_process.FakeProcess object at 0x7fa6500b27b0>
fake = True

    @pytest.mark.parametrize("fake", [False, True])
    def test_check_call(fp, fake):
        fp.allow_unregistered(not fake)
        if fake:
            fp.register(
                [PYTHON, "example_script.py"],
                stdout="Stdout line 1\nStdout line 2\n",
            )
            fp.register([PYTHON, "example_script.py", "non-zero"], returncode=1)
        assert subprocess.check_call((PYTHON, "example_script.py")) == 0
    
        # check also non-zero exit code
        with pytest.raises(subprocess.CalledProcessError) as exc:
            assert subprocess.check_call((PYTHON, "example_script.py", "non-zero")) == 1
    
        if sys.version_info >= (3, 6):
>           assert (
                str(exc.value).replace("\\\\", "\\")
                == f"Command '('{PYTHON}', 'example_script.py', 'non-zero')' "
                "returned non-zero exit status 1."
            )
E           assert "Command ('/u...xit status 1." == "Command '('/...xit status 1."
E             
E             - Command '('/usr/bin/python3', 'example_script.py', 'non-zero')' returned non-zero exit status 1.
E             ?         -                                                     -
E             + Command ('/usr/bin/python3', 'example_script.py', 'non-zero') returned non-zero exit status 1.


https://docs.python.org/dev/whatsnew/3.16.html#id3:        
    The event loop policy system, including the asyncio.AbstractEventLoopPolicy, asyncio.DefaultEventLoopPolicy, asyncio.WindowsSelectorEventLoopPolicy
    and asyncio.WindowsProactorEventLoopPolicy classes and the asyncio.get_event_loop_policy() and asyncio.set_event_loop_policy() functions,
    which have been deprecated since Python 3.14. Use asyncio.run() or asyncio.Runner with a custom loop_factory instead.

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

For all our attempts to build python-pytest-subprocess with Python 3.16, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.16/package/python-pytest-subprocess/

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

Let us know here if you have any questions.

Python 3.16 is planned to be included in Fedora 47.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.16.
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.