Conversation
This change fixes several warnings thrown during test suite execution: ``` DeprecationWarning: Call to deprecated close. (Use aclose() instead) -- Deprecated since version 5.0.0. ``` In one case, the `.close()` usage is incorrect and needed to be updated. In another, the `.close()` call is deliberately testing deprecated usage and simply needed the `pytest.deprecated_call()` context manager added. ``` DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead ``` `inspect.iscoroutinefunction()` was added in Python 3.8 and can be safely switched to. Signed-off-by: Kurt McKee <[email protected]>
|
Thanks! I've seen those warnings and meant to tackle them myself, but great to see your PR. If it doesn't break anything on the older Python versions, I don't see a reason for it not to be merged. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #297 +/- ##
==========================================
- Coverage 76.40% 76.39% -0.02%
==========================================
Files 129 129
Lines 34065 34066 +1
==========================================
- Hits 26029 26026 -3
- Misses 8036 8040 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There's more warnings to address, but |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes deprecation warnings seen during the test suite run by updating deprecated async close usage and replacing the deprecated asyncio.iscoroutinefunction helper.
Changes:
- Replace
asyncio.iscoroutinefunction()withinspect.iscoroutinefunction()in the asyncio connection logic. - Update a test to use
aclose()instead of the deprecatedclose(). - Wrap an intentional deprecated
close()call inpytest.deprecated_call().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| valkey/asyncio/connection.py | Switch coroutine function detection away from deprecated asyncio.iscoroutinefunction. |
| tests/test_asyncio/test_cwe_404.py | Update test cleanup to use aclose() to avoid deprecated close(). |
| tests/test_asyncio/test_cluster.py | Explicitly assert the deprecation warning when calling deprecated close(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks again! |
Description of change
This change fixes several warnings thrown during test suite execution [recent CI run examples, see the first two warnings]:
In one case, the
.close()usage is incorrect and needed to be updated. In another, the.close()call is deliberately testing deprecated usage and simply needed thepytest.deprecated_call()context manager added.inspect.iscoroutinefunction()was added in Python 3.8 and can be safely switched to.Pull Request check-list