Bug 2165555 - python-freezegun fails to build with Python 3.12: RuntimeError: There is no current event loop in thread 'MainThread'.
Summary: python-freezegun fails to build with Python 3.12: RuntimeError: There is no c...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-freezegun
Version: 38
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michel Lind
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.12
TreeView+ depends on / blocked
 
Reported: 2023-01-30 12:31 UTC by Tomáš Hrnčiar
Modified: 2023-09-27 19:04 UTC (History)
7 users (show)

Fixed In Version: python-freezegun-1.2.2-4.fc39
Clone Of:
Environment:
Last Closed: 2023-09-27 19:04:01 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2023-01-30 12:31:26 UTC
python-freezegun fails to build with Python 3.12.0a4.


=================================== FAILURES ===================================
__________________________ test_time_freeze_coroutine __________________________

    def test_time_freeze_coroutine():
        if not asyncio:
            raise SkipTest('asyncio required')
    
        @freeze_time('1970-01-01')
        async def frozen_coroutine():
            assert datetime.date.today() == datetime.date(1970, 1, 1)
    
>       asyncio.get_event_loop().run_until_complete(frozen_coroutine())

tests/test_asyncio.py:17: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f58812c8950>

    def get_event_loop(self):
        """Get the event loop for the current context.
    
        Returns an instance of EventLoop or raises an exception.
        """
        if self._local._loop is None:
>           raise RuntimeError('There is no current event loop in thread %r.'
                               % threading.current_thread().name)
E           RuntimeError: There is no current event loop in thread 'MainThread'.

/usr/lib64/python3.12/asyncio/events.py:676: RuntimeError
__________________________ test_time_freeze_async_def __________________________

    def test_time_freeze_async_def():
        try:
            exec('async def foo(): pass')
        except SyntaxError:
            raise SkipTest('async def not supported')
        else:
>           exec(dedent('''
            @freeze_time('1970-01-01')
            async def frozen_coroutine():
                assert datetime.date.today() == datetime.date(1970, 1, 1)
            asyncio.get_event_loop().run_until_complete(frozen_coroutine())
            '''))

tests/test_asyncio.py:26: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
<string>:5: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f58812c8950>

    def get_event_loop(self):
        """Get the event loop for the current context.
    
        Returns an instance of EventLoop or raises an exception.
        """
        if self._local._loop is None:
>           raise RuntimeError('There is no current event loop in thread %r.'
                               % threading.current_thread().name)
E           RuntimeError: There is no current event loop in thread 'MainThread'.

/usr/lib64/python3.12/asyncio/events.py:676: RuntimeError
=========================== short test summary info ============================
FAILED tests/test_asyncio.py::test_time_freeze_coroutine - RuntimeError: Ther...
FAILED tests/test_asyncio.py::test_time_freeze_async_def - RuntimeError: Ther...
============ 2 failed, 113 passed, 6 skipped, 3 deselected in 0.65s ============

The get_event_loop() method of the default event loop policy now emits a
DeprecationWarning if there is no current event loop set and it decides to
create one. (Contributed by Serhiy Storchaka and Guido van Rossum in
gh-100160.)

asyncio.get_event_loop() and many other asyncio
functions like ensure_future(), shield() or gather(), and also the
get_event_loop() method of BaseDefaultEventLoopPolicy now raise a RuntimeError
if called when there is no running event loop and the current event loop was
not set. Previously they implicitly created and set a new current event loop.
DeprecationWarning is no longer emitted if there is no running event loop but
the current event loop is set in the policy. (Contributed by Serhiy Storchaka
in gh-93453.)

https://github.com/python/cpython/issues/100160
https://github.com/python/cpython/issues/93453

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.12/fedora-rawhide-x86_64/05263995-python-freezegun/

For all our attempts to build python-freezegun with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/python-freezegun/

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

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
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 Ben Cotton 2023-02-07 15:07:11 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 2 Michel Lind 2023-09-27 19:04:01 UTC
Builds fine against 3.12.0b4: https://koji.fedoraproject.org/koji/buildinfo?buildID=2251048


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