test.check

Add a retry-limited version of `such-that`

Details

  • Type: Enhancement Enhancement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

The docstring of such-that states that

Eventually we will add another generator combinator that only tries N times before giving up.

So I found it reasonable to add an issue just so it's not forgotten. Seems reasonable to have it throw a RuntimeException with an explanation that such-that attempted to do more than N tries.

Additionally, I think it would be valuable to have a runtime-error in the general such-that implementation, e.g. on 10000 retries, possibly with an explanation on how to override the default retry-limit. I've heard of many people (myself included) not being really sure where their infinite loop is within their test.check code, and I guess such-that is the culprit in very many cases. This might help debugging those issues, although it would break backwards compatibility.

Activity

Hide
Reid Draper added a comment -

Fixed in 719d64d60419638f22e3ceca5e37fe075df652ea. Should be in the next release.

Show
Reid Draper added a comment - Fixed in 719d64d60419638f22e3ceca5e37fe075df652ea. Should be in the next release.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: