Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MarkusBiggus opened this issue Jan 9, 2025 · 0 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@MarkusBiggus
Copy link

MarkusBiggus commented Jan 9, 2025

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

@MarkusBiggus MarkusBiggus added the type-bug An unexpected behavior, bug, or error label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant