Skip to content

Strengthen retry repr, wait cap and idle time tests - #717

Open
xuu33030 wants to merge 1 commit into
jd:mainfrom
xuu33030:test/issue-715-effective-assertions
Open

xuu33030 wants to merge 1 commit into
jd:mainfrom
xuu33030:test/issue-715-effective-assertions

Conversation

@xuu33030

Copy link
Copy Markdown

Summary

Closes #715. This strengthens the tests; it does not fix or change production behavior.

  • Assert controller class, configuration and name in repr, including asyncio and Tornado's sleep functions, without pinning memory addresses.
  • Cover wait_incrementing(max=...) at and beyond the cap, for numeric and timedelta limits.
  • Replace all four idle_for: mock.ANY expectations with exact totals. The existing wrappers actually use the default zero wait, so the successful retry cases now temporarily use wait_fixed(0.25) with only sleeping mocked out. The real retry loop accumulates 0.5s (sync) / 0.25s (async); stopping after the first attempt remains 0.
  • Remove the two legacy string-strategy constructor smoke tests: they neither execute retries nor establish support for callable-incompatible strings. Existing callable-strategy tests remain.
  • Add a release note as requested by the contribution guide.

Verification

On macOS, Python 3.10.20 (the minimum supported version), using the project's development dependencies and poe all in a network-denied sandbox:

  • Ruff lint and format checks passed.
  • Mypy passed: 19 source files.
  • Pytest: 183 passed.
  • Sphinx doctests: 35 passed.
  • Sphinx HTML build passed with -W.
  • git diff --check passed.

I also ran the full suite in separate temporary source copies, applying each mutation independently to both baseline (3e58094) and updated tests:

Deliberate production mutation Baseline tests Updated tests
BaseRetrying.__repr__ returns "" Pass (missed) Three repr tests fail
wait_incrementing omits min(result, self.max) Pass (missed) Both max-limit subtests fail
Statistics skip accumulating sleep into idle_for Pass (missed) Sync and async statistics tests fail

None of these mutations are included in the commit. Tests without mutations pass. Other Python versions/platforms have not been run locally and remain for CI.

AI assistance: this contribution was investigated, authored and locally verified using Hermes Agent.

This branch has not been deployed

No deployments
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.

Three repr tests assert nothing; wait_incrementing's max cap and the idle_for statistic have no test that pins them

1 participant