merge queue: checking main (b189e15) and #682 together - #693
Closed
mergify[bot] wants to merge 3 commits into
Closed
merge queue: checking main (b189e15) and #682 together#693mergify[bot] wants to merge 3 commits into
mergify[bot] wants to merge 3 commits into
Conversation
Two more error codes mypy leaves off under `strict`, both with real hits in the test suite. `possibly-undefined`: `test_retry_state` bound `retry_state` only inside an `except ExtractCallState` block, then used it unconditionally. Had the retry stopped raising, the test would have failed with `NameError` instead of a useful assertion. Use `assertRaises` as a context manager, which both asserts the exception is raised and binds the state unconditionally. `deprecated`: `asyncio.iscoroutinefunction` is deprecated since 3.14 and removed in 3.16, and was emitting a `DeprecationWarning` on every test run. The line right below it already asserts the same property via `inspect.iscoroutinefunction`, which is the documented replacement, so drop the deprecated call rather than pin the suite to an API that is going away. Change-Id: I135cf5364f3e471d954c878f2599be7441104971
`explicit-override` is off under `strict`, and 63 methods across the library and tests were overriding a base method without saying so. That makes a whole class of change silently lossy: rename or drop a method on `retry_base`/`wait_base`/`stop_base`/`BaseRetrying` and every subclass keeps its now-orphaned implementation, still importable, never called again. `typing.override` only exists from Python 3.12, and tenacity has no runtime dependencies, so `_utils` imports it from `typing_extensions` under TYPE_CHECKING (as the module already does for `Self`) and falls back to a small PEP 698 shim at runtime on 3.10/3.11. Type checkers only ever see the `typing_extensions` name, so the check works regardless of the interpreter mypy runs under. That last point exposed a second problem worth fixing here: mypy's `python_version` defaults to whatever interpreter runs it, so CI on 3.14 was never verifying that the code is valid on the 3.10 we claim to support. Pin `python_version = "3.10"` to match `requires-python`. It caught one real case immediately -- `RetryCallState.__getstate__` is only an override from 3.11 on, where `object.__getstate__` was introduced, so it must not carry the decorator. Verified `mypy` reports the same result under both a 3.10 and a 3.14 interpreter, and the runtime shim sets `__override__` correctly on 3.10. Change-Id: Ide71dd204215e82012f6a9b1afc725dd7c5db8ee
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎉 This pull request has been checked successfully and will be merged soon. 🎉
Branch main (b189e15) and #682 are queued together for merge.
This pull request has been created by Mergify to check the mergeability of #682.
You don't need to do anything. Mergify will close this pull request automatically when it is complete.
Required conditions of queue rule
defaultfor merge:depends-on = jd/tenacity#681[⛓️ test: fix possibly-undefined and deprecated call sites #681]github-review-approved[🛡 GitHub branch protection]Required conditions to stay in the queue:
check-success=test (3.10, check)check-success=test (3.11, check)check-success=test (3.12, check)check-success=test (3.13, check)check-success=test (3.14, check)check-success=test (3.14, lint)check-success=test (3.14, mypy)depends-on = jd/tenacity#681[⛓️ test: fix possibly-undefined and deprecated call sites #681]github-review-approved[🛡 GitHub branch protection]author = jd#approved-reviews-by >= 1author = dependabot[bot]