Skip to content

Spurious warning since Python3.13 task took excessive time when used with freezegun #128658

Open
@MarkusBiggus

Description

Bug report

Bug description:

pytest produces this asyncio warning since Python3.13. Same test with Python3.12 did not.

WARNING:asyncio:Executing <Task pending name='Task-3' coro=<test_batterieresponse_works() running at /home/homeassistant/core/venv/lib/python3.13/site-packages/freezegun/_async.py:15> 
wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.13/asyncio/futures.py:386,
Task.task_wakeup()] created at /usr/local/lib/python3.13/asyncio/base_events.py:460> cb=[_run_until_complete_cb() at /usr/local/lib/python3.13/asyncio/base_events.py:182] 
created at /usr/local/lib/python3.13/asyncio/tasks.py:748> took 1700494914.808 seconds

Can confirm test took about 0.5s and not the nearly 53 years reported.
All tests using the freeze_time fixture reported the warning. Other tests using pytest-asyncio plugin did not report this warning.

import pytest
from freezegun import freeze_time

@pytest.mark.asyncio
@pytest.mark.usefixtures("battery_charging")
@freeze_time("20-11-2023 17:00:00")
@patch.object(urllib3.HTTPConnectionPool, 'urlopen', __battery_configurations_auth200)
async def test_batterieresponse_works(battery_charging: Batterie) -> None:

Related packages installed:

Package                                 Version           Editable project location
--------------------------------------- ----------------- -------------------------
async_interrupt                         1.2.0
async-timeout                           4.0.3
asyncio                                 3.4.3
asyncmock                               0.4.2
freezegun                               1.5.1
frozenlist                              1.5.0
homeassistant                           2025.2.0.dev0     /home/homeassistant/core
pytest                                  8.3.4
pytest-aiohttp                          1.0.5
pytest-asyncio                          0.24.0
pytest-cov                              6.0.0
pytest_freezer                          0.4.8
pytest-github-actions-annotate-failures 0.2.0
pytest-mock                             3.14.0
pytest-picked                           0.5.0
pytest-socket                           0.7.0
pytest-sugar                            1.0.0
pytest-timeout                          2.3.1
pytest-unordered                        0.6.1
pytest-xdist                            3.6.1
python-dateutil                         2.9.0.post0
python-slugify                          8.0.4
virtualenv                              20.28.1

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Metadata

Assignees

No one assigned

    Labels

    pendingThe issue will be closed if no feedback is providedtype-bugAn unexpected behavior, bug, or error

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions