Skip to content

Conversation

@Bastian-Krause
Copy link
Member

Description
asyncio.iscoroutinefunction() is deprecated [1] since Python 3.14 [2]. Use inspect.iscoroutinefunction() instead.

This fixes the latest CI errors happening since #1748 was merged. Python 3.14 checks did not run because #1723 was merged after #1748 was created. The DeprecationWarning breaks an assert in tests/test_client.py::test_place_acquire_multiple.

[1] https://docs.python.org/3/deprecations/index.html#pending-removal-in-python-3-16
[2] python/cpython@bc9d92c

Checklist

  • PR has been tested

…dule

asyncio.iscoroutinefunction() is deprecated [1] since Python 3.14 [2].
Use inspect.iscoroutinefunction() instead.

[1] https://docs.python.org/3/deprecations/index.html#pending-removal-in-python-3-16
[2] python/cpython@bc9d92c

Signed-off-by: Bastian Krause <bst@pengutronix.de>
@Bastian-Krause Bastian-Krause changed the title remote/client: use non-deprecated iscoroutinefunction from inspect module remote/client: use non-deprecated iscoroutinefunction() from inspect module Nov 16, 2025
@codecov
Copy link

codecov bot commented Nov 16, 2025

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.2%. Comparing base (9709747) to head (5cfe634).
⚠️ Report is 2 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
labgrid/remote/client.py 0.0% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1772     +/-   ##
========================================
- Coverage    45.2%   45.2%   -0.1%     
========================================
  Files         172     172             
  Lines       13555   13556      +1     
========================================
  Hits         6136    6136             
- Misses       7419    7420      +1     
Flag Coverage Δ
3.10 45.2% <0.0%> (-0.1%) ⬇️
3.11 45.2% <0.0%> (-0.1%) ⬇️
3.12 45.2% <0.0%> (-0.1%) ⬇️
3.13 45.2% <0.0%> (-0.1%) ⬇️
3.14 45.2% <0.0%> (?)
3.9 45.3% <0.0%> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MarekSzczypinski
Copy link

You were faster than me @Bastian-Krause! I'm in the middle of writing issue about this ;-)

Apart from the fix you proposed, the other way of solving this issue is to add the -W ignore::DeprecationWarning flags to the problematic python call in the unit test to silence the warning for the sake of test.

I was thinking about this, because while your solution exists already in Python <= 3.9 the documentation states that asyncio.iscoroutinefunction and inspect.iscoroutinefunction work differently. Still in labgrid we're not using the @coroutine it mentions.
But on the other hand implementation in new versions of Python (I've just checked the 3.14) of asyncio.iscoroutinefunction directly calls the inspect.iscoroutinefunction, so I guess your fix is a better and more future-proof solution.

@Bastian-Krause
Copy link
Member Author

You were faster than me @Bastian-Krause! I'm in the middle of writing issue about this ;-)

👍

Apart from the fix you proposed, the other way of solving this issue is to add the -W ignore::DeprecationWarning flags to the problematic python call in the unit test to silence the warning for the sake of test.

While it would fix the CI, it would further hide such warnings. We need to fix them anyway, rather sooner than later. I'm working on a PR that will explicitly turn warnings into errors in the test suite, so we see them clearly instead of stumbling upon those by accident as we did here.

I was thinking about this, because while your solution exists already in Python <= 3.9 the documentation states that asyncio.iscoroutinefunction and inspect.iscoroutinefunction work differently. Still in labgrid we're not using the @coroutine it mentions. But on the other hand implementation in new versions of Python (I've just checked the 3.14) of asyncio.iscoroutinefunction directly calls the inspect.iscoroutinefunction, so I guess your fix is a better and more future-proof solution.

It's also my understanding that labgrid is not affected by the differing behavior which was present before Python 3.10.

@Bastian-Krause Bastian-Krause merged commit b218dc7 into labgrid-project:master Nov 17, 2025
10 of 12 checks passed
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