Skip to content

Conversation

@pastalian
Copy link

@pastalian pastalian commented Jun 25, 2025

*1: asyncio.get_event_loop() now raises a RuntimeError in Python 3.14
when no loop exists.
https://docs.python.org/3.14/whatsnew/3.14.html#id7

_____________________________________________________________________________________________ ERROR at setup of test_on_exception_coro_cancelling _____________________________________________________________________________________________
file /var/tmp/portage/dev-python/backoff-2.2.1/work/backoff-2.2.1/tests/test_backoff_async.py, line 667
  @pytest.mark.asyncio
  async def test_on_exception_coro_cancelling(event_loop):
      sleep_started_event = asyncio.Event()

      @backoff.on_predicate(backoff.expo)
      async def coro():
          sleep_started_event.set()

          try:
              await asyncio.sleep(10)
          except asyncio.CancelledError:
              return True

          return False

      task = event_loop.create_task(coro())

      await sleep_started_event.wait()

      task.cancel()

      assert (await task)
E       fixture 'event_loop' not found
>       available fixtures: _class_event_loop, _function_event_loop, _module_event_loop, _package_event_loop, _session_event_loop, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, capteesys, doctest_namespace, event_loop_policy, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory, unused_tcp_port, unused_tcp_port_factory, unused_udp_port, unused_udp_port_factory
>       use 'pytest --fixtures [testpath]' for help on them.
__________________________________________________________________________________________ test_on_predicate_on_regular_function_without_event_loop ___________________________________________________________________________________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f1ab5f52200>

    def test_on_predicate_on_regular_function_without_event_loop(monkeypatch):
        monkeypatch.setattr('time.sleep', lambda x: None)
    
        # Set default event loop to None.
>       loop = asyncio.get_event_loop()
               ^^^^^^^^^^^^^^^^^^^^^^^^

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f1ab5f52200>

tests/test_backoff_async.py:695: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

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

    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'.

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

/usr/lib/python3.14/asyncio/events.py:718: RuntimeError
__________________________________________________________________________________________ test_on_exception_on_regular_function_without_event_loop ___________________________________________________________________________________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f1ab5846190>

    def test_on_exception_on_regular_function_without_event_loop(monkeypatch):
        monkeypatch.setattr('time.sleep', lambda x: None)
    
        # Set default event loop to None.
>       loop = asyncio.get_event_loop()
               ^^^^^^^^^^^^^^^^^^^^^^^^

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f1ab5846190>

tests/test_backoff_async.py:719: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

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

    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'.

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

/usr/lib/python3.14/asyncio/events.py:718: RuntimeError

- Remove deprecated event_loop fixture
  https://pytest-asyncio.readthedocs.io/en/stable/reference/changelog.html#removed
- Drop *_without_event_loop tests
  These incompatible tests (*1) are no longer needed since the
  underlying code has already been removed (introduced in a460156,
  removed in 5d714cc).

*1: asyncio.get_event_loop() now raises a RuntimeError in Python 3.14
    when no loop exists.
    https://docs.python.org/3.14/whatsnew/3.14.html#id7
@pastalian
Copy link
Author

Hi @edgarrmondragon, just checking in to see if you or any other maintainers have been able to review this PR.
Please let me know if there’s anything I can help with. Thanks!

pastalian referenced this pull request in gentoo/guru Jul 30, 2025
These are revdeps of the unmaintained dev-python/backoff, which is
masked for removal in ::gentoo.

Signed-off-by: Lucio Sauer <watermanpaint@posteo.net>
@praiskup
Copy link

Ping here, is this PR under any review?

@edgarrmondragon
Copy link

@praiskup yes, I'm about to take some time to go over CI and other aspects so we can start merging things here 🙂

@edgarrmondragon edgarrmondragon self-assigned this Aug 19, 2025
@edgarrmondragon
Copy link

Thanks @pastalian!

@edgarrmondragon edgarrmondragon merged commit 28db941 into python-backoff:main Aug 19, 2025
8 checks passed
@edgarrmondragon edgarrmondragon added this to the v2.2.2 milestone Aug 23, 2025
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 this pull request may close these issues.

3 participants